mirror of
https://github.com/jgthms/bulma.git
synced 2024-11-14 11:14:24 +00:00
Makes adding colors easier
Just map your colors, the bulma way ($name: ($color[,$invert]) into $custom-colors, and import bulma. Note that, you can provide only the color as the inverted would be computed from it.
This commit is contained in:
parent
fecfa3c263
commit
4bf1010ec6
@ -75,8 +75,9 @@ $size-medium: $size-5 !default
|
|||||||
$size-large: $size-4 !default
|
$size-large: $size-4 !default
|
||||||
|
|
||||||
// Lists and maps
|
// Lists and maps
|
||||||
|
$custom-colors: null !default
|
||||||
|
|
||||||
$colors: ("white": ($white, $black), "black": ($black, $white), "light": ($light, $light-invert), "dark": ($dark, $dark-invert), "primary": ($primary, $primary-invert), "link": ($link, $link-invert), "info": ($info, $info-invert), "success": ($success, $success-invert), "warning": ($warning, $warning-invert), "danger": ($danger, $danger-invert)) !default
|
$colors: colorMap(("white": ($white, $black), "black": ($black, $white), "light": ($light, $light-invert), "dark": ($dark, $dark-invert), "primary": ($primary, $primary-invert), "link": ($link, $link-invert), "info": ($info, $info-invert), "success": ($success, $success-invert), "warning": ($warning, $warning-invert), "danger": ($danger, $danger-invert)), $custom-colors) !default
|
||||||
$shades: ("black-bis": $black-bis, "black-ter": $black-ter, "grey-darker": $grey-darker, "grey-dark": $grey-dark, "grey": $grey, "grey-light": $grey-light, "grey-lighter": $grey-lighter, "white-ter": $white-ter, "white-bis": $white-bis) !default
|
$shades: ("black-bis": $black-bis, "black-ter": $black-ter, "grey-darker": $grey-darker, "grey-dark": $grey-dark, "grey": $grey, "grey-light": $grey-light, "grey-lighter": $grey-lighter, "white-ter": $white-ter, "white-bis": $white-bis) !default
|
||||||
|
|
||||||
$sizes: $size-1 $size-2 $size-3 $size-4 $size-5 $size-6 $size-7 !default
|
$sizes: $size-1 $size-2 $size-3 $size-4 $size-5 $size-6 $size-7 !default
|
@ -1,3 +1,25 @@
|
|||||||
|
@function colorMap($bulma-colors, $custom-colors)
|
||||||
|
// we return at least bulma hardcoded colors
|
||||||
|
$merged-colors: $bulma-colors
|
||||||
|
// we want a map as input
|
||||||
|
@if type-of($custom-colors) == 'map'
|
||||||
|
@each $name, $components in $custom-colors
|
||||||
|
// color name should be a string and colors pair a list with at least one element
|
||||||
|
@if type-of($name) == 'string' and (type-of($components) == 'list' or type-of($components) == 'color') and length($components) >= 1
|
||||||
|
$color-base: nth($components, 1)
|
||||||
|
$color-invert: null
|
||||||
|
// is an inverted color provided ?
|
||||||
|
@if length($components) > 1
|
||||||
|
$color-invert: nth($components, 2)
|
||||||
|
// we only want a color as base color
|
||||||
|
@if type-of($color-base) == 'color'
|
||||||
|
// if inverted color is not provided or is not a color we compute it
|
||||||
|
@if type-of($color-invert) != 'color'
|
||||||
|
$color-invert: findColorInvert($color-base)
|
||||||
|
// we merge this colors elements as map with bulma colors (we can override them this way, no multiple definition for the same name)
|
||||||
|
$merged-colors: map_merge($merged-colors, ($name: ($color-base, $color-invert)))
|
||||||
|
@return $merged-colors
|
||||||
|
|
||||||
@function powerNumber($number, $exp)
|
@function powerNumber($number, $exp)
|
||||||
$value: 1
|
$value: 1
|
||||||
@if $exp > 0
|
@if $exp > 0
|
||||||
|
Loading…
Reference in New Issue
Block a user