@@ -94,28 +96,30 @@ shades:
From: Spencer Kordecki
| Color | -Variable | -Value | -Computed value | -Invert value | -Computed invert value | -
|---|
| - {{ derivedColor.id | capitalize }} - | -
- ${{ derivedColor.id }}
- |
-
- ${{ initialColor.id }}
- |
- - {% include elements/color-square.html value=initialColor.value %} - | - {% if derivedColor.invertValue %} +Color | +Variable | +Value | +Computed value | +Invert value | +Computed invert value | +
|---|---|---|---|---|---|---|---|---|---|
- {{ derivedColor.invertValue }}
+ {{ derivedColor.id | capitalize }}
|
- {% include elements/color-square.html value=derivedColor.invertValue %}
+ ${{ derivedColor.id }}
|
- {% elsif derivedColor.invertId %}
- {% assign invertColor = site.data.colors.initial | where: "id", derivedColor.invertId | first %}
- ${{ derivedColor.invertId }}
+ ${{ initialColor.id }}
|
- {% include elements/color-square.html value=invertColor.value %} + {% include elements/color-square.html value=initialColor.value %} | - {% endif %} -
{{ derivedColor.invertValue }}
+ ${{ derivedColor.invertId }}
+ @@ -94,28 +96,30 @@ shades:
| Color | -Variable | -Value | -
|---|
| - {{ initial_shade.name | capitalize }} - | -
- ${{ initial_shade.id }}
- |
- - {% include elements/color-square.html value=initial_shade.value %} - | +Color | +Variable | +Value |
|---|
${{ initial_shade.id }}
+ #fffIts purpose is to guarantee a readable shade for the text when the input color is used as the background.
-| color | -color luminance | -findColorInvert() | -result | -
|---|---|---|---|
-
- #00d1b2
- |
-
- 0.52831
- |
-
-
- #fff
- |
- - - Button - - | -
-
- #3273dc
- |
-
- 0.23119
- |
-
-
- #fff
- |
- - - Button - - | -
-
- #23d160
- |
-
- 0.51067
- |
-
-
- #fff
- |
- - - Button - - | -
-
- #ffdd57
- |
-
- 0.76863
- |
-
-
- rgba(0, 0, 0, 0.7)
- |
- - - Button - - | -
-
- #ff3860
- |
-
- 0.27313
- |
-
-
- #fff
- |
- - - Button - - | -
-
- #ffb3b3
- |
-
- 0.61796
- |
-
-
- rgba(0,0,0,0.7)
- |
- - - Button - - | -
-
- #ffbc6b
- |
-
- 0.63053
- |
-
-
- rgba(0,0,0,0.7)
- |
- - - Button - - | -
-
- hsl(294, 71%, 79%)
- |
-
- 0.5529
- |
-
-
- rgba(0,0,0,0.7)
- |
- - - Button - - | -
| color | +color luminance | +findColorInvert() | +result | +
|---|---|---|---|
+
+ #00d1b2
+ |
+
+ 0.52831
+ |
+
+
+ #fff
+ |
+ + + Button + + | +
+
+ #3273dc
+ |
+
+ 0.23119
+ |
+
+
+ #fff
+ |
+ + + Button + + | +
+
+ #23d160
+ |
+
+ 0.51067
+ |
+
+
+ #fff
+ |
+ + + Button + + | +
+
+ #ffdd57
+ |
+
+ 0.76863
+ |
+
+
+ rgba(0, 0, 0, 0.7)
+ |
+ + + Button + + | +
+
+ #ff3860
+ |
+
+ 0.27313
+ |
+
+
+ #fff
+ |
+ + + Button + + | +
+
+ #ffb3b3
+ |
+
+ 0.61796
+ |
+
+
+ rgba(0,0,0,0.7)
+ |
+ + + Button + + | +
+
+ #ffbc6b
+ |
+
+ 0.63053
+ |
+
+
+ rgba(0,0,0,0.7)
+ |
+ + + Button + + | +
+
+ hsl(294, 71%, 79%)
+ |
+
+ 0.5529
+ |
+
+
+ rgba(0,0,0,0.7)
+ |
+ + + Button + + | +
For colors that have a luminance close to the 0.55 threshold, it can be useful to override the findColorInvert() function, and rather set the invert color manually.
For example, this shade of purple has a color luminance of 0.5529. It can be preferable to set a color invert of white instead of transparent black:
- with findColorInvert()
- |
-
- $purple-invert: findColorInvert($purple)
- |
-
-
- rgba(0,0,0,0.7)
- |
- - - Button - - | -
|---|---|---|---|
| - with manual setting - | -
- $purple-invert: #fff
- |
-
-
- #fff
- |
- - - Button - - | -
+ with findColorInvert()
+ |
+
+ $purple-invert: findColorInvert($purple)
+ |
+
+
+ rgba(0,0,0,0.7)
+ |
+ + + Button + + | +
|---|---|---|---|
| + with manual setting + | +
+ $purple-invert: #fff
+ |
+
+
+ #fff
+ |
+ + + Button + + | +
=arrow($color) |
- Creates a CSS-only down arrow. Used for the dropdown select. | -
=block |
- Defines a margin-bottom of 1.5rem, except when the element is the last child. Used for almost all block elements. | -
=clearfix |
- Adds a clearfix at the end of the element. Used for the "is-clearfix" helper. | -
=center($size) |
- Positions an element in the exact center of its parent. Used for the spinner in a loading button. | -
=delete |
- Creates a CSS-only cross. Used for the delete element in modals, messages, tags... | -
=fa($size, $dimensions) |
- Sets the style of a Font Awesome icon container. | -
=hamburger($dimensions) |
- Creates a CSS-only hamburger menu with 3 bars. Used for the "nav-toggle". | -
=loader |
- Creates a CSS-only loading spinner. Used for the ".loader" element, and for input and button spinners. | -
=overflow-touch |
- Sets the style of a container so that it keeps momentum when scrolling on iOS devices. | -
=overlay($offset: 0) |
- Makes the element overlay its parent container, like the transparent modal background. | -
=placeholder |
- Sets the styles of an input placeholder. | -
=unselectable |
- Turns the element unselectable. Used for buttons to prevent selection when clicking. | -
=arrow($color) |
+ Creates a CSS-only down arrow. Used for the dropdown select. | +
=block |
+ Defines a margin-bottom of 1.5rem, except when the element is the last child. Used for almost all block elements. | +
=clearfix |
+ Adds a clearfix at the end of the element. Used for the "is-clearfix" helper. | +
=center($size) |
+ Positions an element in the exact center of its parent. Used for the spinner in a loading button. | +
=delete |
+ Creates a CSS-only cross. Used for the delete element in modals, messages, tags... | +
=fa($size, $dimensions) |
+ Sets the style of a Font Awesome icon container. | +
=hamburger($dimensions) |
+ Creates a CSS-only hamburger menu with 3 bars. Used for the "nav-toggle". | +
=loader |
+ Creates a CSS-only loading spinner. Used for the ".loader" element, and for input and button spinners. | +
=overflow-touch |
+ Sets the style of a container so that it keeps momentum when scrolling on iOS devices. | +
=overlay($offset: 0) |
+ Makes the element overlay its parent container, like the transparent modal background. | +
=placeholder |
+ Sets the styles of an input placeholder. | +
=unselectable |
+ Turns the element unselectable. Used for buttons to prevent selection when clicking. | +
These mixins are already used throughout Bulma, but you can use them as well to extend your own styles.