UNPKG

colorjs.io

Version:

Let’s get serious about color

28 lines (24 loc) 909 B
import RGBColorSpace from "../rgbspace.js"; // convert an array of linear-light rec2020 values to CIE XYZ // using D65 (no chromatic adaptation) // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html // 0 is actually calculated as 4.994106574466076e-17 const toXYZ_M = [ [ 0.6369580483012914, 0.14461690358620832, 0.1688809751641721 ], [ 0.2627002120112671, 0.6779980715188708, 0.05930171646986196 ], [ 0.000000000000000, 0.028072693049087428, 1.060985057710791 ], ]; // from ITU-R BT.2124-0 Annex 2 p.3 const fromXYZ_M = [ [ 1.716651187971268, -0.355670783776392, -0.253366281373660 ], [ -0.666684351832489, 1.616481236634939, 0.0157685458139111 ], [ 0.017639857445311, -0.042770613257809, 0.942103121235474 ], ]; export default new RGBColorSpace({ id: "rec2020-linear", cssId: "--rec2020-linear", name: "Linear REC.2020", white: "D65", toXYZ_M, fromXYZ_M, });