- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Tue, 19 Apr 2022 21:27:27 +0000
- To: public-houdini-archive@w3.org
As Chris said, the Typed OM is intended to represent CSS values in the form of JS objects; any use beyond that is incidental. In particular, CSSColorValue and its subclasses are *not* intended to be an accurate, general-purpose color representation or manipulation library. The current design is driven by a few considerations: 1. For `CSSColor` values (representing the CSS `color()` function), I need to expose the color space keyword given as the first argument (currently, one of the [`<predefined-rgb>`](https://drafts.csswg.org/css-color-4/#typedef-predefined-rgb) or [`<xyz-space>`](https://drafts.csswg.org/css-color-4/#typedef-xyz-space) keywords). 2. For the `CSSColorValue.to()` method, which allows you to convert a value between the various CSS functions, I need a way to identify the function you want to convert to (or, for `color()`, which color space you want to convert to). For `color()` I can obviously just use the color space keyword; for the other CSS color functions the most obvious choice is to use the function name. 3. Since the `.colorSpace` and `.to()` values match for `CSSColor`, it seems reasonable to shift `.colorSpace` up to the superclass and have it match for *all* the subclasses, so `CSSRGB` (representing the CSS `rgb()` function) has "rgb" for both, etc. I believe the current design gives the most straightforward and understandable result for manipulating CSS values, even if it's odd, incomplete, or inaccurate when discussing colors more generally. I don't believe it's valuable *for the Typed OM* to try and be more accurate in general color terminology; that's simply not what it's meant for. @svgeesus and @LeaVerou are working on a `Color` class for the web platform that *does* accurately reflect colors and is *not* deeply tied to CSS syntax. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/1044#issuecomment-1103190686 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 19 April 2022 21:27:28 UTC