@@ -89,15 +89,15 @@ function lin_sRGB(t){return t.map((function(t){const _=t<0?-1:1,o=Math.abs(t);re
8989 *
9090 * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
9191 */
92- function D50_to_D65 ( t ) { return multiplyMatrices ( [ [ .9554734527042182 , - .023098536874261423 , .0632593086610217 ] , [ - .028369706963208136 , 1.0099954580058226 , .021041398966943008 ] , [ .012314001688319899 , - .020507696433477912 , 1.3303659366080753 ] ] , t ) }
92+ function D50_to_D65 ( t ) { return multiplyMatrices ( [ [ .955473421488075 , - .02309845494876471 , .06325924320057072 ] , [ - .0283697093338637 , 1.0099953980813041 , .021041441191917323 ] , [ .012314014864481998 , - .020507649298898964 , 1.330365926242124 ] ] , t ) }
9393/**
9494 * Bradford chromatic adaptation from D65 to D50
9595 * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
9696 *
9797 * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
9898 *
9999 * @see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html
100- */ function D65_to_D50 ( t ) { return multiplyMatrices ( [ [ 1.0479298208405488 , .022946793341019088 , - .05019222954313557 ] , [ .029627815688159344 , .990434484573249 , - .01707382502938514 ] , [ - .009243058152591178 , .015055144896577895 , .7518742899580008 ] ] , t ) }
100+ */ function D65_to_D50 ( t ) { return multiplyMatrices ( [ [ 1.0479297925449969 , .022946870601609652 , - .05019226628920524 ] , [ .02962780877005599 , .9904344267538799 , - .017073799063418826 ] , [ - .009243040646204504 , .015055191490298152 , .7518742814281371 ] ] , t ) }
101101/**
102102 * Convert an array of linear-light rec2020 RGB in the range 0.0-1.0
103103 * to gamma corrected form ITU-R BT.2020-2 p.4
@@ -301,7 +301,7 @@ function OKLab_to_OKLCH(t){const _=180*Math.atan2(t[2],t[1])/Math.PI;return[t[0]
301301 * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
302302 *
303303 * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
304- */ function OKLab_to_XYZ ( t ) { const _ = multiplyMatrices ( [ [ .9999999984505198 , .39633779217376786 , .2158037580607588 ] , [ 1.0000000088817609 , - .10556134232365635 , - .06385417477170591 ] , [ 1.0000000546724108 , - .08948418209496575 , - 1.2914855378640917 ] ] , t ) ; return multiplyMatrices ( [ [ 1.2268798733741557 , - .5578149965554813 , .28139105017721583 ] , [ - .04057576262431372 , 1.1122868293970594 , - .07171106666151701 ] , [ - .07637294974672142 , - .4214933239627914 , 1.5869240244272418 ] ] , _ . map ( ( t => t ** 3 ) ) ) }
304+ */ function OKLab_to_XYZ ( t ) { const _ = multiplyMatrices ( [ [ 1 , .3963377773761749 , .2158037573099136 ] , [ 1 , - .1055613458156586 , - .0638541728258133 ] , [ 1 , - .0894841775298119 , - 1.2914855480194092 ] ] , t ) ; return multiplyMatrices ( [ [ 1.2268798758459243 , - .5578149944602171 , .2813910456659647 ] , [ - .0405757452148008 , 1.112286803280317 , - .0717110580655164 ] , [ - .0763729366746601 , - .4214933324022432 , 1.5869240198367816 ] ] , _ . map ( ( t => t ** 3 ) ) ) }
305305/**
306306 * Convert an array of gamma-corrected sRGB values in the 0.0 to 1.0 range to HSL.
307307 *
@@ -367,7 +367,7 @@ function XYZ_to_Lab(t){const _=t.map(((t,_)=>t/r[_])).map((t=>t>.008856451679035
367367 *
368368 * XYZ <-> LMS matrices recalculated for consistent reference white
369369 * @see https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-943521484
370- */ function XYZ_to_OKLab ( t ) { const _ = multiplyMatrices ( [ [ .8190224432164319 , .3619062562801221 , - .12887378261216414 ] , [ .0329836671980271 , .9292868468965546 , .03614466816999844 ] , [ .048177199566046255 , .26423952494422764 , .6335478258136937 ] ] , t ) ; return multiplyMatrices ( [ [ .2104542553 , .793617785 , - .0040720468 ] , [ 1.9779984951 , - 2.428592205 , .4505937099 ] , [ .0259040371 , .7827717662 , - .808675766 ] ] , _ . map ( ( t => Math . cbrt ( t ) ) ) ) }
370+ */ function XYZ_to_OKLab ( t ) { const _ = multiplyMatrices ( [ [ .819022437996703 , .3619062600528904 , - .1288737815209879 ] , [ .0329836539323885 , .9292868615863434 , .0361446663506424 ] , [ .0481771893596242 , .2642395317527308 , .6335478284694309 ] ] , t ) ; return multiplyMatrices ( [ [ .210454268309314 , .7936177747023054 , - .0040720430116193 ] , [ 1.9779985324311684 , - 2.42859224204858 , .450593709617411 ] , [ .0259040424655478 , .7827717124575296 , - .8086757549230774 ] ] , _ . map ( ( t => Math . cbrt ( t ) ) ) ) }
371371/**
372372 * Convert an array of three XYZ values to u*,v* chromaticity coordinates
373373 *
0 commit comments