summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/color.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/color.js b/js/color.js
index ddabf1d..879a78b 100644
--- a/js/color.js
+++ b/js/color.js
@@ -57,7 +57,7 @@ function xyz2rgb(xyz){
function xyz2hunterlab (XYZ) {
var X = XYZ[0]
- var Y = XYZ[1]
+ var Y = XYZ[1] || 1e-6 // otherwise divide-by-zero error when converting rgb(0,0,0)
var Z = XYZ[2]
var L = 10 * sqrt( Y )
var a = 17.5 * ( ( ( 1.02 * X ) - Y ) / sqrt( Y ) )