chrisbra / Colorizer

color hex codes and color names
547 stars 30 forks source link

Highlights variables in Sass files #31

Closed moll closed 10 years ago

moll commented 10 years ago

Hey again,

Took another look at this plugin, so expect a few new issues. :)

Using it in a Sass file highlights variables with color names in them. So, for example, the following black gets a black background:

.minor { color: $light-black }
chrisbra commented 10 years ago

What are the allowed color names? What is the filetype for those files?

moll commented 10 years ago

Filetype for a Sass file in my case is scss.css. Strings with a $ prefix are variables and can be named whatever you wish. I just happen to include regular color names in brand color variables, but as they're variables and don't necessarily refer to real color names, I'd say they shouldn't be colored. Would you agree?

chrisbra commented 10 years ago

Hi Andri!

On Mo, 27 Jan 2014, Andri Möll wrote:

Filetype for a Sass file in my case is scss.css. Strings with a $ prefix are variables and can be named whatever you wish. I just happen to include regular color names in brand color variables, but as they're variables and don't necessarily refer to real color names, I'd say they shouldn't be colored. Would you agree?

The Colorizer plugin has no understanding of variables or statements or other things (for that it would need to parse the file and that is way beyond the scope of the plugin [and would probably be really slow]). It doesn't care and just colors everything, that looks like a valid color name or pattern.

In this particular case, I guess it is good enough to prevent it to match, when there is a '-' in front of the color and that is what I just did.

Best,

Christian

A good supervisor can step on your toes without messing up your shine.

moll commented 10 years ago

:+1:

Would that fix also "fix" names like $black-beauty being colored?

chrisbra commented 10 years ago

Yes