Unquoted color names are confusing
See original GitHub issuewith 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:
- Created 9 years ago
- Reactions:2
- Comments:29 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
This returns
false
. Sass does no type coercion in==
.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.
@nex3 sorry, just reading back through the thread again - is this suggestion what the v4 alpha commit here is about?