How to add "exotic color space" support to CSS? #578
-
I swear I saw, in this repo, talk about adding "exotic" color-space support using JavaScript for the CSS I really could use OKHSV in my project. And then .... I have to hope browsers can create gradients through this exotic color-space. Any current word on that possibility? Otherwise, I'll have to create it manually with an HTML canvas. HMMM....maybe I should anyway for when the project moves beyond sRGB....? Either way, knowing how to add "exotic" color-space support to CSS would be nice. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Okhsv has already been added on main, it just hasn't been released formally yet. I think you can pull the unreleased code from |
Beta Was this translation helpful? Give feedback.
-
That's a long file, and I don't have time here at the end of the day to study it. It will be 2 weeks before I have more time. Keeping current..... So you're saying, in this file, I can find the code to add OKHSV support directly to CSS in an HTML page via JavaScript? Then I just hope browsers can grade "through" OKHSV with that support... Y'all really are awesome. Thanks again for your help! Aloha! |
Beta Was this translation helpful? Give feedback.
CSS does not directly support exotic color spaces. CSS color level 5 mentions custom color spaces that you can link to color profiles though: https://drafts.csswg.org/css-color-5/#custom-color. I don't know if any browsers support it though, and I think it is limited to RGB style profiles, but that's the closest you have.
The only other way to support exotic color spaces is to use a library that manipulates colors in the space you care about and then convert them to CSS supported color spaces.