Bulma: Invalid output when declaring a custom shade map

Created on 20 May 2019  路  8Comments  路  Source: jgthms/bulma

This is about Bulma.

Overview of the problem

When declaring a custom shade map, the colour helper functions for "has-background-{shade}" and "has-text-{shade}" outputs in an invalid css format.

This issue was previously reported but has been subsequently closed without a fix.

Description

Using Bulma 0.7.4, I am trying to define custom shades and add a color to it (i.e. fuchsia). I need to find a way for having the corresponding helper classes generated (.has-text-fuchsia .has-background-fuchsia).

Steps to Reproduce

Add $fuchsia to $custom-shades, like so:

$fuchsia: #d705a3
$custom-shades: ("fuchsia": $fuchsia);

When I do that, Bulma first runs mergeColorMaps and then generates the classes, except the ones corresponding to $custom-shades are wrong, because findColorInvert is also called, which adds #fff as the default inverted color.

This works without problems if I use $custom-colors (either specifying the inverted color or not).

Expected behavior

The CSS output should be:

.has-text-fuchsia { color: #d705a3 !important; }

Actual behavior

The CSS output is:

.has-text-fuchsia { color: #d705a3, #fff !important; }

Most helpful comment

Is there a future release date for this fix?

All 8 comments

Indeed, that's an issue. Let me look into it.

Is there a future release date for this fix?

@jgthms Any plans on releasing a new version with this fix soon?

I still see this problem on version 0.8.0. Anyone else has this problem?

I still see this problem on version 0.8.0. Anyone else has this problem?

In base/helpers.sass, should update :

@each $name, $shade in $shades
  $shade: nth($shade, 1)
  .has-text-#{$name}
    color: $shade !important
  .has-background-#{$name}
    background-color: $shade !important

The line $shade: nth($shade, 1) is missing.

This issue is still happening, and it actually got even worse than on previous versions, as now the resulting color: holds four values.

I am seeing the same behaviour in 9.0.0, as @matheusgrieger pointed out with 4 values now.

This issue is definitely not closed as I still see four values for has-text-[shadeName] on Bulma 0.9.1.

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

choonggg picture choonggg  路  3Comments

jaredreich picture jaredreich  路  3Comments

guillecro picture guillecro  路  3Comments

JenCant picture JenCant  路  3Comments

Cosbgn picture Cosbgn  路  3Comments