Re: [css-houdini-drafts] [css-typed-om] `toColor()` intentionally restricted to predefined colors? (#1030)

Currently intentional, but intended to be temporary.

Basically, I'm not sure how to handle the reference to a custom space when doing color conversion (to or from `CSSColor`). This is a somewhat generic problem with CSS-based references vs JS - in CSS references are defined on a per-tree basis (so shadows don't interact with each other, and can theoretically have same-name references without colliding), but JS stretches across trees, so it's not clear where it should be grabbing the ref from.

(I know that I'm inconsistent here - the *other* conversion functions don't check that a `CSSColor` value is using a predefined space. They should, and throw in that case.)

Note that you can *directly create* a CSSColor in a custom colorspace, so you can still use it in CSS; you just can't convert it to other spaces.

My vague plan is to let people provide a Document/ShadowRoot reference to the conversion functions, and have it draw on that to figure out the definition of the custom colorspace. (And use the same strategy for other cases across CSS that run into the same problem.)

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/1030#issuecomment-839922816 using your GitHub account


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

Received on Wednesday, 12 May 2021 16:30:02 UTC