DEV Community

Discussion on: A cool way to handle scss color variables

Collapse
 
nicolalc profile image
Nicola

That's a nice tip, this example focuses only on naming variables, of course, you might use a mixin to handle them because is the best way to.

I don't use the color- prefix because I use them often by a SCSS map which defines a colour prefix for variables, for example:

$colours: (
  $background: black,
  $on-background: white
);

anyway thanks for the suggestion this might be really useful 🤞

Collapse
 
capsule profile image
Thibaut Allender

Well I thought about talking about maps too :-)
I rarely use them because it's just too much of a pain to read them back.
$colour-background is way easier to type (and read) than map.get($colours, "background")