|
| 1 | +--- |
| 2 | +title: "Light and Dark colors, better look, larger buttons, panel colors, and more" |
| 3 | +layout: post |
| 4 | +introduction: "A big update for more colors and flexibility" |
| 5 | +color: "primary" |
| 6 | +name: "Light/Dark colors, better look, larger controls" |
| 7 | +icon: "sun" |
| 8 | +published: false |
| 9 | +--- |
| 10 | + |
| 11 | +The new version **[Bulma 0.8.0](#)** is out! It comes with several bug fixes and a lot of nice new features: |
| 12 | + |
| 13 | +* [Light/Dark colors](#light-dark-colors) |
| 14 | +* [Better visual look](#better-visual-look) |
| 15 | +* [Panel colors](#panel-colors) |
| 16 | +* [4-value color map](#4-value-color-map) |
| 17 | +* [Scheme variables](#scheme-variables) |
| 18 | + |
| 19 | +More in the [Changelog](#). |
| 20 | + |
| 21 | +{% include elements/anchor.html name="Light/Dark colors" %} |
| 22 | + |
| 23 | +Each main color (`"primary"`, `"info"`, `"success"`, `"warning"`, `"danger"`) now comes with a `*-light` and a `*-dark` version. They are calculated using 2 new color functions: |
| 24 | + |
| 25 | +* `findLightColor()` which finds the light version of a color |
| 26 | +* `findDarkolor()` which finds the dark version of a color |
| 27 | + |
| 28 | +The **light** colors are used by the `button` element: |
| 29 | + |
| 30 | +<figure> |
| 31 | + <a href="{{ site.data.links.by_id.elements-button.path }}"> |
| 32 | + <img src="{{ site.url }}/images/blog/v8/light-buttons-bis.png" alt="List Bulma buttons" width="530" height="104"> |
| 33 | + </a> |
| 34 | +</figure> |
| 35 | + |
| 36 | +The **light** and **dark** colors are used by the `message` component, which generates much prettier colored versions. See the difference between before (left) and after (right): |
| 37 | + |
| 38 | +<div class="bd-post-fullwidth"> |
| 39 | + <a href="{{ site.data.links.by_id.components-message.path }}"> |
| 40 | + <img src="{{ site.url }}/images/blog/v8/messages-before.png" alt="Messages before" width="448" height="1200"> |
| 41 | + <img src="{{ site.url }}/images/blog/v8/messages-after.png" alt="Messages after" width="448" height="1200"> |
| 42 | + </a> |
| 43 | +</div> |
| 44 | + |
| 45 | +{% include elements/anchor.html name="Better visual look" %} |
| 46 | + |
| 47 | +Some of the Bulma colors have been updated: |
| 48 | + |
| 49 | +<table> |
| 50 | + <tr> |
| 51 | + <th>Color</th> |
| 52 | + <th>Before</th> |
| 53 | + <th>After</th> |
| 54 | + </tr> |
| 55 | + <tr> |
| 56 | + <th> |
| 57 | + <code>$green</code> |
| 58 | + </th> |
| 59 | + <td> |
| 60 | + {% include elements/color-square.html value="hsl(141, 71%, 48%)" %} |
| 61 | + </td> |
| 62 | + <td> |
| 63 | + {% include elements/color-square.html value="hsl(141, 53%, 53%)" %} |
| 64 | + </td> |
| 65 | + </tr> |
| 66 | + <tr> |
| 67 | + <th> |
| 68 | + <code>$cyan</code> |
| 69 | + </th> |
| 70 | + <td> |
| 71 | + {% include elements/color-square.html value="hsl(204, 86%, 53%)" %} |
| 72 | + </td> |
| 73 | + <td> |
| 74 | + {% include elements/color-square.html value="hsl(204, 71%, 53%)" %} |
| 75 | + </td> |
| 76 | + </tr> |
| 77 | + <tr> |
| 78 | + <th> |
| 79 | + <code>$red</code> |
| 80 | + </th> |
| 81 | + <td> |
| 82 | + {% include elements/color-square.html value="hsl(348, 100%, 61%)" %} |
| 83 | + </td> |
| 84 | + <td> |
| 85 | + {% include elements/color-square.html value="hsl(348, 86%, 61%)" %} |
| 86 | + </td> |
| 87 | + </tr> |
| 88 | +</table> |
| 89 | + |
| 90 | +The <strong>shadows</strong> of the <code>box</code> and <code>card</code> have been improved: |
| 91 | + |
| 92 | +<div class="bd-post-fullwidth"> |
| 93 | + <a href="{{ site.data.links.by_id.components-card.path }}"> |
| 94 | + <img src="{{ site.url }}/images/blog/v8/card-before.png" alt="Card before" width="464" height="236"> |
| 95 | + <img src="{{ site.url }}/images/blog/v8/card-after.png" alt="Card after" width="464" height="236"> |
| 96 | + </a> |
| 97 | +</div> |
| 98 | + |
| 99 | +<div class="bd-post-fullwidth"> |
| 100 | + <a href="{{ site.data.links.by_id.elements-box.path }}" style="display: block;" class="has-text-centered"> |
| 101 | + <img src="{{ site.url }}/images/blog/v8/box-before.png" alt="Box before" width="464" height="236"> |
| 102 | + <img src="{{ site.url }}/images/blog/v8/box-after.png" alt="Box after" width="464" height="236"> |
| 103 | + </a> |
| 104 | +</div> |
| 105 | + |
| 106 | +{% include elements/anchor.html name="Panel colors" %} |
| 107 | + |
| 108 | +<p> |
| 109 | + The <a href="{{ site.data.links.by_id.components-panel.path }}">panel component</a> is now available in all <strong>colors</strong>: |
| 110 | +</p> |
| 111 | + |
| 112 | +<div class="bd-post-fullwidth"> |
| 113 | + <a href="{{ site.data.links.by_id.components-panel.path }}"> |
| 114 | + <img src="{{ site.url }}/images/blog/v8/panel-colors.png" alt="Panel colors" width="768" height="1029"> |
| 115 | + </a> |
| 116 | +</div> |
| 117 | + |
| 118 | +{% include elements/anchor.html name="4-value color map" %} |
| 119 | + |
| 120 | +The `$colors` Sass map now accepts, for each of its values, a map of up to **4** values. For example: the key `"info"` now has the `($info, $info-invert, $info-light, $info-dark)` map. |
| 121 | + |
| 122 | +If you provide a `$custom-colors` map, you can decide to provide a map of 1, 2, 3 or 4 values for each value. If fewer than 4 are provided, Bulma will calculate the remaining ones: |
| 123 | + |
| 124 | +```scss |
| 125 | +$custom-colors: ( |
| 126 | + "lime": (lime), |
| 127 | + "tomato": (tomato, white), |
| 128 | + "orange": ($orange, $orange-invert, $orange-light), |
| 129 | + "lavender": ($lavender, $lavender-invert, $lavender-light, $lavender-dark) |
| 130 | +); |
| 131 | +``` |
| 132 | + |
| 133 | +This is processed by the updated `mergeColorMaps()` Sass function. |
| 134 | + |
| 135 | +{% include elements/anchor.html name="Scheme variables" %} |
| 136 | + |
| 137 | +There are 6 new `$scheme` derived variables: `$scheme-main` `$scheme-main-bis` `$scheme-main-ter` `$scheme-invert` `$scheme-invert-bis` `$scheme-invert-ter` |
| 138 | +They replace the `$white` and `$black` occurences in the codebase. This makes it easy to create a "Dark mode" simply by swapping the values: |
| 139 | + |
| 140 | +```sass |
| 141 | +$scheme-main: $black |
| 142 | +$scheme-invert: $white |
| 143 | +// etc. |
| 144 | +``` |
| 145 | + |
| 146 | +That is also why most of the codebase now references **derived** variables (`$text`, `$background`, `$border` etc.) instead of **initial** ones (`$grey`, `$grey-lighter`, `$grey-darker` etc.): updating the derived variables will affect all elements and components directly. |
0 commit comments