Debian Codegraph @

node/colorjs.io/src/spaces/rec2020-linear.js

raw
1 import RGBColorSpace from "../RGBColorSpace.js";
2
3 /** @import { Matrix3x3 } from "../types.js" */
4
5 /**
6 * Matrices used by this color space, also available as `REC_2020_Linear.M`.
7 * Uses D65 (no chromatic adaptation).
8 * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
9 * @type {Record<string, Matrix3x3>}
10 */
11 // prettier-ignore
12 export const M = {
13 // 0 is actually calculated as 4.994106574466076e-17
14 toXYZ: [
15 [ 0.6369580483012914, 0.14461690358620832, 0.1688809751641721 ],
16 [ 0.2627002120112671, 0.6779980715188708, 0.05930171646986196 ],
17 [ 0.000000000000000, 0.028072693049087428, 1.060985057710791 ],
18 ],
19 // from ITU-R BT.2124-0 Annex 2 p.3
20 fromXYZ: [
21 [ 1.716651187971268, -0.355670783776392, -0.253366281373660 ],
22 [ -0.666684351832489, 1.616481236634939, 0.0157685458139111 ],
23 [ 0.017639857445311, -0.042770613257809, 0.942103121235474 ],
24 ],
25 };
26
27 export default new RGBColorSpace({
28 id: "rec2020-linear",
29 cssId: "--rec2020-linear",
30 name: "Linear REC.2020",
31 white: "D65",
32 M,
33 });