question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unquoted color names are confusing

See original GitHub issue

with style: compressed, the replacement of some colornames to hex codes takes place even in map keys. This is unexpected if not a bug.

Example below compiles uncompressed, but gets a syntax error compressed.

Syntax error: Invalid CSS after “&.”: expected class name, was “#90ee90” on line 14 of demo.scss

(version 3.3.7)

$schemes: (
        lightgreen: (
                primary: rgb(30, 151, 64),
                secondary: rgb(149, 0, 70)
        )
);

a {
  text-decoration: none;
  color:  #999;
  @each $name, $spec in $schemes {
    &.#{$name} { color: map-get($spec, primary) }
  }
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:2
  • Comments:29 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
nex3commented, Jan 8, 2016

I’m not interested in changing the existing behavior. It does have some awkward edge-cases, but the underlying logic is clear and unambiguous—colors and strings are wholly separate types, and the implementation has license to treat all colors the same regardless of their literal format.

1 == '1'

This returns false. Sass does no type coercion in ==.

the v4 alpha commit here is about?

No. That commit is purely cosmetic; it makes colors more similar to their source definition in human-readable output formats, but it doesn’t change the language itself. In particular, in compressed mode, Sass will still choose the smallest possible format for a color. This may be behavior users are relying on, and I’m not willing to change it.

0reactions
barneycarrollcommented, Dec 19, 2015

@nex3 sorry, just reading back through the thread again - is this suggestion what the v4 alpha commit here is about?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Color Names Have Become Too Confusing | Next Avenue
Fanciful names for colors abound in catalogs and on retail websites.
Read more >
unquoted words are confusing | DefinitiveDrupal.org
The book instructs you to disable the Color and Overlay modules. At press time, disabling the Color module left the Slate color in...
Read more >
Confused by color naming — am I now color blind?
There was “stinger” (yellow) and “white cap” (blue, go figure) and “celadon” (which can be either pale green or pale blue, your pick)...
Read more >
Maps - Sass
This is because some values, such as color names, may look like unquoted strings but actually be other types. To avoid confusing problems...
Read more >
How do ggplot and dplyr select unquoted variables in function
Within ggplot2 and dplyr , functions do not require the column name of the variable to be quoted. Here are some examples:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found