JuliaGraphics / ColorTypes.jl

Basic color definitions and traits
Other
77 stars 35 forks source link

Relationship to colour spaces in other graphics standards #311

Open mgkuhn opened 3 weeks ago

mgkuhn commented 3 weeks ago

The PDF colour spaces are defined in section 8.6 of the PDF standard ISO 32000:2008. In particular, PDF distinguishes between

The SVG specification, merely distinguishes between sRGB and linearRGB spaces, mainly for colour interpolation.

The recent CSS Color Module Level 4 specification now offers the following colour spaces: srgb, srgb-linear, display-p3, a98-rgb, prophoto-rgb, rec2020, xyz, xyz-d50, xyz-d65

Would there be any interest (or are there any plans) here to add here more of these to ColorTypes.jl?

Or at least to have an official mapping table in the documentation, to clarify which of the existing types here are meant to correspond to which PDF/CSS/etc. colour types?

This might help to standardize how plotting libraries (where the Julia user can use these types to specify colours) should map them when producing PostScript/PDF/SVG/CSS/etc. outputs. For example, it would be nice to have a DeviceCMYK-like type that can be used by the user of a Julia plotting library to directly control how their printer should mix the four toners/inks to draw a line. Likewise, it would be useful to distinguish between linear and gamma-corrected RGB types.

kimikage commented 3 weeks ago

This is what color management systems should support, and we believe it is undesirable by design to have at least ColorTypes.jl define a separate type for each color space.

I examined an add-on to support YUV-like colors (and the corresponding RGB spaces). cf. https://kimikage.github.io/YUVColorTypes.jl/dev/ Mainly due to my motivation, the lack of progress in its development implies that there is "chaos".

Device-dependent color spaces, as listed above, have practically no information about the color space. Even if a well-defined standard exists, there are in fact several variations (in OETF/EOTF/OOTF, Chromatic adaptation, etc.), and a color space may not be strictly defined by its name alone. In short, the contexts are too large for the ColorTypes.jl types to have.

I am in favor of creating add-ons to support them.