preserve function correctGamma ( n ) { return n > 0.04045 ? ( ( n + 0.055 ) / 1.055 ) ** 2.4 : n / 12.92 ; } export function rgb2xyz ( r , g , b ) { r = correctGamma ( r / 255 ) ; g = correctGamma ( g / 255 ) ; b = correctGamma ( b / 255 ) ; return { x : r * 0.4124 + g * 0.3576 + b * 0.1805 , y : r * 0.2126 + g * 0.7152 + b * 0.0722 , z : r * 0.0193 + g * 0.1192 + b * 0.9505 , } ; }