How to add custom colors to Bulma?
Asked Answered
I

1

10

I have found this code:

$custom-colors: null !default

$colors: mergeColorMaps(("white": ($white, $black), "black": ($black, $white), "light": ($light, $light-invert), "dark": ($dark, $dark-invert), "primary": ($primary, $primary-invert, $primary-light, $primary-dark), "link": ($link, $link-invert, $link-light, $link-dark), "info": ($info, $info-invert, $info-light, $info-dark), "success": ($success, $success-invert, $success-light, $success-dark), "warning": ($warning, $warning-invert, $warning-light, $warning-dark), "danger": ($danger, $danger-invert, $danger-light, $danger-dark)), $custom-colors) !default

How to extend the list of colors and classes associated with each color? It's clear I need to define a variable $custom-colors before including Bulma, but it's not clear what format of $custom-colors should be? I didn't find an example or good description of that. Any help?

Imperium answered 17/7, 2021 at 6:49 Comment(0)
I
12

I found this, I test it and works perfectly. You must add this to your customized sass main file.

https://github.com/jgthms/bulma/issues/2244

https://bulma.io/documentation/customize/with-node-sass/

$orange: #ff8606;
$orange-invert: findColorInvert($orange);
$custom-colors: ("orange": ($orange, $orange-invert));

After this, you can use the new color like:

<button class="button is-orange">Orange</button>
Imperium answered 17/7, 2021 at 9:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.