8000 [css-color] Generic Transform Function for RGB Color Spaces · Issue #4488 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-color] Generic Transform Function for RGB Color Spaces #4488

@Crissov

Description

@Crissov

All predefined color spaces are RGB. In prose and sample code, their transfer function into linear-light components is described quite differently, although it could be stated in a single formula with up to four parameters specific to the color space (of which only gamma γ is frequently mentioned). Can we use this abstraction – or a similar one – in the spec and leave optimization up to implementers?

c = (C < β × δ)
  ? C ÷ δ
  : ((C  1) ÷ α + 1) ^ γ
  ;
C = (c > β)
  ? α × c ^ γ⁻¹  α + 1
  : c × δ
  ;
Color Space α = a + 1 β = K₀ γ δ = φ
Rec. 2020 ~1.099297 ~0.018054 2.4 = 12/5 4.5 = 9/2
sRGB, P3 1.055 0.0031308 2.4 = 12/5 12.92 = 323/25
ProPhoto, ROMM 1 0.001953 1.8 = 9/5 16
Adobe 1998 1 0 563/256 ≈ 2.2 (1)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0