Skip to content

Commit 4cf0e6e

Browse files
committed
tweaks
1 parent bde6d2b commit 4cf0e6e

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

css-color/matrixmaker.html

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
const xwhite=0.3127 ;
2525
const ywhite=0.3290 ;
2626

27+
2728
// Relative XYZ values. Copy-paste-o-rama
2829
var XWhite=xwhite/ywhite;
2930
var YWhite=1;
@@ -35,9 +36,26 @@
3536

3637
var XGreen=xgreen/ygreen;
3738
var YGreen=1;
38-
var ZGreen=(1 - xgreen - ygreen)/green;
39-
40-
var white = math.matrix([])
39+
var ZGreen=(1 - xgreen - ygreen)/ygreen;
40+
41+
var XBlue=xblue/yblue;
42+
var YBlue=1;
43+
var ZBlue=(1 - xblue - yblue)/yblue;
44+
45+
var white = math.matrix([XWhite, YWhite, ZWhite]);
46+
var primaries = [
47+
[XRed, XGreen, XBlue],
48+
[YRed, YGreen, YBlue],
49+
[ZRed, ZGreen, ZBlue]
50+
];
51+
52+
// S is easier if it ends up as an array than a matrix
53+
// but we use matrix math to calculate it
54+
var S = math.multiply(math.inv(math.matrix(primaries)),white).value;
55+
56+
var M = math.matrix([
57+
[]
58+
]);
4159

4260
</script>
4361
</html>

0 commit comments

Comments
 (0)