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

I wonder if we should be a bit more descriptive in the names of the channels/components for clarity, readability, and clearer autocomplete (potentially allowing for `'none'` values).

Here's what I mean:

```json5
{
  "PrettyInPink": {
    "$type": "color",
    "$value": {
      "$hex": "#ff70b8",
      // Give each color scheme its own object type,
      // with descriptive keys
      "$dcip3": {
        "red": 0.76, 
        "green": 0.28, 
        "blue": 0.62 
      },
      "$oklch": {
        "lightness": 0.72, 
        "chroma": 0.46, 
        "hue": 329 
      }
    }
  }
}
```

<details>
<summary>JSON Schema for $oklch</summary>

Ported from the [CSS Color Module 4 OKLCH notation spec](https://www.w3.org/TR/css-color-4/#funcdef-lch) 

```json
{
  "type": "object",
  "properties": {
    "lightness": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 100,
          "title": "The numeric value for lightness, from 0.0 (darkest) to 100.0 (lightest) without any unit"
        },
        {
          "type": "string",
          "pattern": "^(100%|[1-9]?[0-9]%|none)$",
          "title": "The percentage value for lightness or 'none' to indicate it is not defined"
        }
      ]
    },
    "chroma": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 150,
          "title": "The numeric value for chroma, scaled from 0 (neutral) to 150 (vivid)"
        },
        {
          "type": "string",
          "pattern": "^(100%|[1-9]?[0-9]%|none)$",
          "title": "The percentage value for chroma, where 100% is mapped to the numeric value 150 or 'none' to indicate it is not defined"
        }
      ]
    },
    "hue": {
      "oneOf": [
        {
          "type": "number",
          "title": "The numeric value for hue, interpreted in degrees"
        },
        {
          "type": "string",
          "pattern": "^(none)$",
          "title": "The string 'none' to indicate no hue defined"
        }
      ]
    },
    "alpha": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "title": "The numeric value for alpha transparency, from 0.0 (fully transparent) to 1.0 (fully opaque)"
        },
        {
          "type": "string",
          "pattern": "^(100%|[1-9]?[0-9]%|none)$",
          "title": "The percentage value for alpha transparency or 'none' to indicate full opacity"
        }
      ]
    }
  },
  "required": ["lightness", "chroma", "hue"],
  "additionalProperties": false
}
```

</details>

Thoughts from folks in this thread?

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


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

Received on Monday, 6 November 2023 19:48:15 UTC