summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorjules <jules@okfoc.us>2014-08-26 19:06:03 -0400
committerjules <jules@okfoc.us>2014-08-26 19:06:03 -0400
commitd4460f375dd7cf29faf0f53947b3fb5e405a0e25 (patch)
treea0527e475ba80f1df1664ad838f1c045ee4062e5 /js
parentb4c2e36240ab3e2715d119a84c0c124ffabc3725 (diff)
handle divide-by-zero error on xyz2hunterlab
Diffstat (limited to 'js')
-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 ) )