facelessuser / ColorHelper

Sublime plugin that provides helpful color previews and tooltips
https://facelessuser.github.io/ColorHelper/
MIT License
254 stars 30 forks source link

Add color rule for JavaScript and JSX syntax #235

Closed mstade closed 1 year ago

mstade commented 1 year ago

What's changed, and why?

This adds support for colors embedded in strings in the JavaScript and JSX syntaxes. This greatly helps when developing UI using CSS-in-JS systems such as Stitches or Styled Components. Here's an example of this rule in action:

Screenshot 2022-09-28 at 20 06 23

Related resources

This should take care of #87.

facelessuser commented 1 year ago

I think generally, the rule looks good. I slightly question whether it is good to enable it by default, at least with color names enabled, as prose that mentions a color name will get a preview, but maybe that is not a worry for most people 🤷🏻.

facelessuser commented 1 year ago

@gir-bot lgtm

facelessuser commented 1 year ago

I think we'll just leave it enabled by default. If we get any complaints, we might consider disabling it by default, but I suspect that most people may be fine with it.

mstade commented 1 year ago

I think generally, the rule looks good. I slightly question whether it is good to enable it by default, at least with color names enabled, as prose that mentions a color name will get a preview, but maybe that is not a worry for most people 🤷🏻.

Prose as in comments? I think that's covered by the string.quoted scope. At least, I'm not seeing any color previews when writing colors in comments, which is good because commenting out colors is a frequent operation when trying things out! 😅

But prose as in quoted strings in the code? That seems like a bit of an edge case, and I'd say the value definitely outweighs that issue. But if not enabled by default, maybe adding it as a helpful tip in the docs?

mstade commented 1 year ago

I think we'll just leave it enabled by default. If we get any complaints, we might consider disabling it by default, but I suspect that most people may be fine with it.

Hah, we seem to have commented at the same time! 😅 Many thanks for the merge!

facelessuser commented 1 year ago

But prose as in quoted strings in the code? That seems like a bit of an edge case, and I'd say the value definitely outweighs that issue. But if not enabled by default, maybe adding it as a helpful tip in the docs?

Yeah, that is what I was referring to, not comments as the scope clearly excludes them. And that was my conclusion as well. For those that it might bother, I suspect the value outweighs the annoyance.