Skip to content

Conversation

@ccameron-chromium
Copy link
Contributor

@ccameron-chromium ccameron-chromium commented Aug 5, 2025

Canvas2D: Add srgb-linear and display-p3-linear to PredefinedColorSpace enum

(See WHATWG Working Mode: Changes for more details.)


/canvas.html ( diff )
/infrastructure.html ( diff )

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OP needs filling out. You can consider WebKit interested.

I think we should also have a follow-up issue on formalizing "color space" better. We say these values map to CSS-defined color spaces, but most of the "color space" concepts say they hold a PredefinedColorSpace as value, which seems wrong. We should translate from the string to the CSS color spaces and then use those throughout.

We'll also need tests for all the various things taking a PredefinedColorSpace.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes this requirement obsolete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch -- this was a merge conflict badly resolved (this text had moved).

@ccameron-chromium ccameron-chromium changed the title Canvas2D: Add rec2100-linear to PredefinedColorSpace enum Canvas2D: Add srgb-linear and display-p3-linear to PredefinedColorSpace enum Oct 22, 2025
@ccameron-chromium ccameron-chromium changed the title Canvas2D: Add srgb-linear and display-p3-linear to PredefinedColorSpace enum Canvas2D: Add srgb-linear, display-p3-linear, and rec2100-linear to PredefinedColorSpace enum Oct 24, 2025
@ccameron-chromium ccameron-chromium changed the title Canvas2D: Add srgb-linear, display-p3-linear, and rec2100-linear to PredefinedColorSpace enum Canvas2D: Add srgb-linear and display-p3-linear to PredefinedColorSpace enum Oct 24, 2025
@ccameron-chromium
Copy link
Contributor Author

I've updated the OP and added tests for the HTML APIs that use PredefinedColorSpace.

I've limited this change to only add the srgb-linear and display-p3-linear spaces that you requested, and not the original rec2100-linear. This is because I want to be very careful about making sure we get the details about rec2020 and rec2100-linear right.

In terms of replacing PredefinedColorSpace with all CSS color spaces, would you be thinking to do just predefined-rgb, or something more expansive (like oklab etc)?

@annevk
Copy link
Member

annevk commented Oct 24, 2025

I wasn't thinking of supporting more color spaces. I was mainly thinking of a mostly editorial change where we convert a PredefinedColorSpace to a CSS color space on input and then pass that around in the model instead of a PredefinedColorSpace (which is just a string and devoid of meaning).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition/proposal New features or enhancements topic: canvas

Development

Successfully merging this pull request may close these issues.

3 participants