facelessuser / ColorHelper

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

Support hsv #207

Closed AmjadHD closed 2 years ago

facelessuser commented 2 years ago

ColorHelper already supports HSV, that's how we provide the HSV color picker:

Screen Shot 2021-12-22 at 6 44 45 AM

All the supported color spaces are listed here in ColorAides' documentation: https://facelessuser.github.io/coloraide/colors/.


Now, I'm not sure in what context you are attempting to use HSV. When I implement colors in ColorAide, currently, the default syntax is color(identifier channel1 channel2 ... / alpha). Basically, we are using CSS Level 4 syntax to represent all colors. Granted, color() is currently defined in the CSS syntax to represent rectangular colors only, but they are playing with the idea of possibly extending it to all colors. Currently, we extend it to all colors as a generic syntax.

Now, any color that is not a supported color in CSS or does not specifically supports the color() syntax in CSS gets a custom identifier (color(--custom ...)). HSV is not a supported CSS color, so it is defined as color(--hsv h s v / a), where h is hue, s is a saturation between 0 - 1, v is a value between 0 - 1. You can optionally use percentages for s and v if desired.

Custom color spaces are not searched in any file type by default as we have configured the default rules to ignore finding custom color() indentifiers (--id).

But, you can still enter them in certain modes. Here we mix HSV colors in Oklab.

Screen Shot 2021-12-22 at 6 58 25 AM

While Oklab and Oklch were recently added in the CSS Level 4 specification, we have yet added the official CSS syntax as a default input/output as there is still some discussion on the final syntax going on, so it is also only implemented in the color(--custom ...) form.

facelessuser commented 2 years ago

If there is some kind of request here, above and beyond what is already supported, do let me know as I do have a release ready to go.

AmjadHD commented 2 years ago

Sorry I didn't notice the hsv support, and didn't know about the color(...) syntax, that's handy.

facelessuser commented 2 years ago

Yeah, I don't really advertise them all directly. Most people are looking for CSS color support, but we actually can do a bit more than that.