Skip to content

Commit d68fe60

Browse files
committed
[css-color-hdr] Added the clamp function which is used in hdr-color()
1 parent 00e3873 commit d68fe60

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

css-color-hdr-1/colorHdrInterpolate.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ function hdrColor(col1, H1, col2, H2, H) {
1515
cxyz[i] = Math.pow(c1xyz[i] + eps, w1) * Math.pow(c2xyz[i] + eps, w2) - eps;
1616
}
1717
return cxyz;
18-
}
18+
}
19+
20+
const clamp = (n, min, max) =>
21+
Math.min(Math.max(n, min), max)

0 commit comments

Comments
 (0)