Open LeaVerou opened 1 year ago
@tabatkins comment from #23 had an interesting idea: using @color-profile
for the registration:
We do plan to allow them to be used together, but we're not yet sure how. That said, I'm almost certain it won't be by naively merging the namespaces. Instead, I suspect that either we'll come up with an alternate syntax for referring to a Color API space by name (which would serve the same purpose as the
--
requirement in@color-profile
, preventing collisions with built-ins); or we'll have some way to plumb a Color API space into@color-profile
more directly, like an additional registration function, or perhaps a way to refer to a Color API space in@color-profile/src
, either of which would mean they'd obey the--
requirement when you ref them incolor()
.
Perhaps we should have some kind of way to register a
ColorSpace
object and make it available to CSS. I imagine it may need a worker of some sort, to separate its scope from JS APIs we don't want CSS colors to depend on, and have some kind of registration function that is only exposed in that worker space.In terms of namespace, I think it's fine if it's the same as colors generated through
@color-profile
(color(--colorspace ...coords)
). E.g. we already have two ways to register custom properties (@property
andCSS.registerProperty()
), and that's fine. In fact, it could even be used to polyfill@color-profile
!Thoughts, @tabatkins ?