Open tomcur opened 1 week ago
What's needed to move this out of draft?
I think when https://github.com/linebender/color/pull/39#discussion_r1844964057 is resolved, we can move this out of draft.
I'm having trouble making a go/no-go decision on this. I like the idea of better CSS compatibility, and the implementation seems fine (though I didn't dig deep), but I also like the idea of the code being minimal, and there are applications that will not need this functionality. I know we talked about this in office hours but don't feel consensus emerged.
Does anyone have a strong feeling either way? My gut feeling is that it's easier to add later if there's a strong need than remove, but if it is going in anyway, now is a good time to do it.
To perform correct CSS Color 4 serialization of colors, some details of how a color was declared have to be preserved. Specifically, CSS Color Module Level 4 § 15.2 and the two sections on Lab and Oklab following it specify that
color()
function – should serialize to that function. (Exceptions beinghsl()
andhwb()
, those serialize torgb()
.)This implementation uses the padding currently available on
DynamicColor
to pack in the color name theDynamicColor
was created from, or whether a named color space function was used; an implementation of the ideas in https://github.com/linebender/color/issues/26#issuecomment-2467997421.DynamicColor
now containsFlags
, and the existingMissing
color components are moved intoFlags
. In this implementation, onlyparse_color
sets the color name or color space function name.