Skip to content

Commit 67e16c0

Browse files
committed
[css-color-4] syntax errors, check L to 400
1 parent e8c7a78 commit 67e16c0

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

css-color-4/L-axis.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<html>
2+
<meta charset="utf-8"></meta>
3+
<script src="math.js"></script>
4+
<script src="conversions.js"></script>
5+
<script>
6+
// make steps along neutral axis of Lab,
7+
// convert to sRGB. Include L values greater than 100.
8+
9+
for (var l =0; l <=400; l+=10) {
10+
var lab = [l, 0, 0];
11+
console.log(lab);
12+
var xyz = Lab_to_XYZ(lab);
13+
var xyz2 = D50_to_D65(xyz);
14+
var linrgb = XYZ_to_lin_sRGB(xyz2);
15+
console.log(linrgb);
16+
var rgb = gam_sRGB(linrgb);
17+
console.log(rgb);
18+
}
19+
</script>
20+
</html>

css-color-4/conversions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function XYZ_to_Lab(XYZ) {
190190
// from CIE standard, which now defines these as a rational fraction
191191
var ε = 216/24389; // 6^3/29^3
192192
var κ = 24389/27; // 29^3/3^3
193-
var white = [[0.96422, 1.00000, 0.82521]; // D50 reference white
193+
var white = [0.96422, 1.00000, 0.82521]; // D50 reference white
194194

195195
// compute xyz, which is XYZ scaled relative to reference white
196196
var xyz = XYZ.map((value, i) => value / white[i]);
@@ -210,7 +210,7 @@ function Lab_to_XYZ(Lab) {
210210
// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
211211
var κ = 24389/27; // 29^3/3^3
212212
var ε = 216/24389; // 6^3/29^3
213-
var white = [[0.96422, 1.00000, 0.82521]; // D50 reference white
213+
var white = [0.96422, 1.00000, 0.82521]; // D50 reference white
214214
var f = [];
215215

216216
// compute f, starting with the luminance-related term

0 commit comments

Comments
 (0)