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.

Rule idea: color-no-non-variables

See original GitHub issue

Someone may want to enforce that any color values are named and reused as variables.

This can make the code more legible and DRY.

// bad
.foo { color: pink; background: #fff; }

// good
$some-color: pink;
$some-background: #fff;
.foo { color: $some-color; background: $some-backgorund; }

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:51
  • Comments:15

github_iconTop GitHub Comments

7reactions
filip-saviccommented, Jun 6, 2017

@davidtheclark If you have variables in a variables.scss or similar file, you could set

"color-no-hex": true,
 "color-named": "never",

so you can’t have either color: #fff or color: white, and just disable linting for those values where they are set.

6reactions
rob-barcommented, Jul 8, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

What do you name color variables? | CSS-Tricks
I first give a name to all the colors I use using that tool, for example “$color-cornflower-blue: #6195ED;” and then I create variables...
Read more >
Managing color variables in front-end project - Akshay Jain
Managing color variables in front-end project · gray colors (gray, black and white) · non-gray colors (rest other colors).
Read more >
Variables, Common CSS Rules and Intro to SASS | Hitchhikers
There are some pre-built color options that you can specify for any property that has a color (ex. background-color, color, border, etc). For...
Read more >
How to Choose Colors for Data Visualizations - Chartio
Qualitative colors are used to identify election candidates in this line chart of support over time. A qualitative palette is used when the...
Read more >
Colors and fonts | IntelliJ IDEA Documentation - JetBrains
By default, the color scheme defines syntax highlighting for reserved words and other symbols in your source code: operators, keywords, ...
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