Closed raphlinus closed 2 weeks ago
I'm pushing this partly for discussion. There's not a huge amount of functionality attached to the new type - maybe that's a good thing, we should encourage all actual manipulation (including parsing) to happen in with the f32-based types.
This PR also changes the serialization of srgb to use the color function. If legacy RGB serialization is desired, the client can convert to Rgba8 first.
I believe that follows the spec, which does that unless the color was constructed directly from a named color or from a named color space (if I'm reading this correctly – note it excludes the color
function). The named color space functions that map to RGB clamp during parse-time according to the spec, so can be represented as legacy RGB when serialized.
e.g.,
rgba(50, 75, 100, 0.8)
serializes to rgba(50, 75, 100, 0.8)
color(srgb 0.1 0.2 0.3 / 0.8)
serializes to color(srgb 0.1 0.2 0.3 / 0.8)
In my experimental draft #39 I'm trying to find a nice implementation according to spec.
Great, I'll merge this and then we can consider further refinements separately.
Adds Rgba8 type and some conversions and formatting.
This PR also changes the serialization of srgb to use the color function. If legacy RGB serialization is desired, the client can convert to Rgba8 first.
Closes #24.