Skip to content

[css-color-4] Define target for gamut mapping for 2D canvas #10112

Closed

Description

@ccameron-chromium

When rendering a CSS color such as our friend oklch(90% 90% 0deg) to a 2D canvas, what gamut should the color be mapped to?

It's not possible to map to the gamut of the display. Two reasons:

  • The display is not knowable in general. E.g, an offscreen canvas, something being streamed to a video or saved as images, or there could be multiple displays.
  • If the display is known, mapping to the gamut of the display is a potent fingerprinting vector.

It may be that the target of mapping should be the color space of the canvas. For the moment this is reasonable.

When we start supporting float16 canvases, it could be less obvious. E.g, an sRGB canvas with float16 pixels can express an arbitrarily wide gamut, so gamut mapping to sRGB would impose undesirable restrictions.

Activity

  1. svgeesus commented on Apr 17, 2025

    @svgeesus
    Collaborator

    Rendering a color to 2D Canvas will always involve converting the color to the color space of the canvas.

    For canvases which cannot hold extended values, this will also involve gamut mapping to the color space of the display. For canvases that can hold extended values, then to enable round tripping there should be no gamut mapping.

  2. svgeesus commented on Mar 31, 2026

    @svgeesus
    Collaborator

    @ccameron-chromium did that answer your question?

  3. svgeesus commented on Sep 1, 2026

    @svgeesus
    Collaborator

    Closed by e733df9

  4. added
    Closed as Question Answered
    on Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed as Question AnsweredCommenter Timed Out (Assumed Satisfied)css-color-4

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo