Support OKLab and OKLCH from Color Level 4
carlosame opened this issue · comments
carlosame commented
In addition to lab()
and lch()
colors, Webkit added support for OKLab and OKLCH colors from Color Level 4.
No issue in Firefox Bugzilla has been opened yet, and the Chromium issue is inactive. Here are the relevant bugs:
- https://bugs.webkit.org/show_bug.cgi?id=233507
- https://bugs.chromium.org/p/chromium/issues/detail?id=1307361
Time to add oklab()
and oklch()
to css4j? For now, I'm adding this issue to the 3.8 milestone.
carlosame commented
Some example conversions from the css4j implementation, compared to Colorjs:
color | oklab(71.834% .0384 0.0347) |
colorjs |
---|---|---|
to lab |
lab(67% 13.404 13.791) |
lab(67.001% 13.398 13.767) |
to lch |
lch(67% 19.232 45.815) |
lch(67.001% 19.211 45.779) |
to rgb |
rgb(75.76%, 60.41%, 54.48%) |
rgb(75.749% 60.412% 54.503%) |
color | oklab(52% -0.14 0.11) |
colorjs |
---|---|---|
to lab |
lab(46.3% -47.214 50.177) |
lab(46.301% -47.22 50.146) |
to lch |
lch(46.3% 68.898 133.257) |
lch(46.301% 68.876 133.28) |
to rgb |
rgb(0%, 50.77%, 0%) |
rgb(2.6452% 50.174% 0%) |
color | oklab(44% -0.04 -0.32) |
colorjs |
---|---|---|
to lab |
lab(27.58% 73.748 -115.575) |
lab(27.569% 73.796 -115.6) |
to lch |
lch(27.58% 137.1 302.542) |
lch(27.569% 137.16 302.55) |
to rgb |
#00f |
rgb(0% 0% 99.827%) |
color | oklch(75.5% 0.16 86.8) |
colorjs |
---|---|---|
to lab |
lab(71.79% 11.228 78.738) |
lab(71.796% 11.216 78.686) |
to lch |
lch(71.79% 79.535 81.884) |
lch(71.796% 79.482 81.888) |
to rgb |
rgb(86.44%, 65.25%, 0%) |
rgb(85.951% 65.415% 0%) |
color | oklch(55% 0.2 145) |
colorjs |
---|---|---|
to lab |
lab(50.09% -56.628 51.674) |
lab(50.094% -56.63 51.643) |
to lch |
lch(50.09% 76.662 137.619) |
lch(50.094% 76.641 137.64) |
to rgb |
rgb(0%, 55.29%, 0%) |
rgb(0% 55.212% 0%) |