ColorHighlighter icon indicating copy to clipboard operation
ColorHighlighter copied to clipboard

named colors highlighted out of context

Open mix3d opened this issue 9 years ago • 6 comments

It seems that wherever a named color is present, regardless of the context, is being highlighted. I love what it's doing otherwise. I know there is already an open issue to allow for removing named colors all together, so I won't request that again.

image

mix3d avatar Feb 11 '16 18:02 mix3d

Would it be a "safe" assumption that it shouldn't match if preceded by a '.' period or '#' octothorpe? Would that break any matches?

mix3d avatar Feb 11 '16 18:02 mix3d

Well, yeah. There is currently some shitty code that treats color formats with @ specially, without regexes. You can't just fix it easily without disabling the whole feature of highlighting color names. I'd have to redesign this part of the plugin.

Monnoroch avatar Feb 11 '16 18:02 Monnoroch

Playing more with it: here's a fun test case for you: image

the last one is highlighted only when the cursor is on it. (any of the un-highlited ones will highlite with the cursor)

Actually, my mistake, it didnt update because I didn't save. Deleting this comment. And the side by side doesn't work because of something in the implementation that wont highlight if they are adjacent words.

mix3d avatar Feb 11 '16 19:02 mix3d

Just wanted to add another example to this issue with Sass variable names.

color-vars

johndugan avatar Mar 29 '16 14:03 johndugan

I didn't want to open a new Issue, just pointing again to the problem with two named colors one after another, as already mentioned by @mix3d. For consecutive words, every second word don't get colored. testcoulors

robinrosenstock avatar Mar 14 '17 21:03 robinrosenstock

Another Use case where the color is being highlighted without the right context. Any way to disable this? (I'm using the text color highlight style)

image_2017-03-22_13-16-2622

s0rthak avatar Mar 22 '17 07:03 s0rthak