Re: [community-group] Legacy color (#137)

> What I would improve is that if `$type: color` has multiple values, the name of the key could represents name of color space. I don't think there is a need for `hex` to be split into channels. It is so widely used as is, so there is no need to complicate its definition.

We considered that, but have decided to just have 1 token = 1 color (1 colorSpace) for now. It would be overly complex for tooling to look at a color and have to sift through which colorSpaces are / aren’t available for a given token, and “rank” what it wants to pull as the color (because, for example, many OKLCH colors have no parallel in HSL, and so [it’s opinionated how you’d even go about converting one to the other](https://bottosson.github.io/posts/gamutclipping/)).

`hex` is just a fallback for `sRGB`, not a competing colorSpace, meant to encourage wider support for older hardware where only `sRGB` is supported. For that reason it’s **optional** and can be omitted if you don’t need it. But many platforms will, and again, [gamut clipping is opinionated and there’s no absolute way to do it](https://bottosson.github.io/posts/gamutclipping/).

Lastly, taking gamut clipping out of the equation, if you’re converting from one colorSpace to another, it’s trivial to do with libraries available like [culori](https://culorijs.org/), so in a sense, declaring multiple colorSpaces on one token is redundant and unnecessary work. No matter what form your color tokens are in, you’ll still have to transform them anyway when delivering code to any platform (web, Android, iOS, etc), and make per-platform decisions on how to do so. A design goal of the DTCG spec is to have platform-agnostic tokens that you can apply platform-specific decisions to later; not to have to solve all your platform problems in one place (even assuming that’s possible).

-- 
GitHub Notification of comment by drwpow
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/137#issuecomment-2166744087 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 13 June 2024 20:45:55 UTC