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

I think a good way to alleviate confusion is to look at what [ICC Standard](https://color.org/specification/ICC.1-2022-05.pdf) uses for terminology. In my opinion, it's good practice to follow convention used by _the_ authority on colour management and be consistent with their vocabulary. 

When most people speak of "colour spaces", they probably actually meant Colour Profiles, which stipulates the following attributes:

* Colour Gamut - specifies the range of colours can be rendered by a device, or captured by a device, or a universal non-device specific colour range (such as sRGB, Display-P3, Rec.2020, etc).
* White Point - specifies the colour temperature of the brightest representable colour.
* Colour Space - specifies how the colour channels mathematically map the entire gamut range. Typically there are four main categories of this: 1.) trichromacity, such as RGB, CMY(K); 2.) colour opponents, such as L\*a\*b\*; and 3.) hue models, such as HSL, or HSV; and finally 4.) monochromacity, such as Y (luminance).
* Transfer Function - specifies how the numerical values of each individual colour component is encoded and stored in memory. For example, many colour profiles save colour components as non-linear values, dedicating more precision to darker tones, and less precision to lighter tones. Quite important for low-precision values (8-bits per channel).

Some special Colour Profiles do not have a Colour Gamut, nor do they use a particular Transfer Function (i.e. values are linear). Examples of this are CIEXYZ, CIELAB, and OKLAB, and they only specify a Colour Space, because they are gamut-independent absolute spaces.

So, if we were to follow ICC way of specifying properties, the following two attributes the should be present: the Colour Profile, and the Colour Space (if applicable). Using and modifying the aforementioned examples, my proposal would look like this:

```js
{
  "my-token": {
    "$type": "color",
    "$value": {
      "colorProfile": "display-p3",
      "colorSpace": "hsl",
      "channels": [0.1, 0.2, 0.3],
      "alpha": 0.6
    }
  }
}
```
For profiles that have an absolute colour space, the `colorSpace` property can be omitted, as the space is implied by the `colorProfile` itself:
```js
{
  "my-token": {
    "$type": "color",
    "$value": {
      "colorProfile": "oklab",
      "channels": [0.1, 0.2, 0.3],
      "alpha": 0.6
    }
  }
}
```


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


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

Received on Friday, 17 May 2024 01:42:00 UTC