From 59b7cdf318336ded6c26ea1b039cf7fa648c189d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 29 Nov 2018 13:10:15 -0800 Subject: [PATCH] Fix empty rgb field in Create going black --- scripts/system/html/js/colpick.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/system/html/js/colpick.js b/scripts/system/html/js/colpick.js index 505dd294d6..e4ad65dfb6 100644 --- a/scripts/system/html/js/colpick.js +++ b/scripts/system/html/js/colpick.js @@ -309,6 +309,9 @@ For usage and examples: colpick.com/plugin }, // Fix the values if the user enters a negative or high value fixHSB = function (hsb) { + hsb.h = isNaN(hsb.h) ? 0 : hsb.h; + hsb.s = isNaN(hsb.s) ? 0 : hsb.s; + hsb.b = isNaN(hsb.b) ? 0 : hsb.b; return { h: Math.min(360, Math.max(0, hsb.h)), s: Math.min(100, Math.max(0, hsb.s)), @@ -316,6 +319,9 @@ For usage and examples: colpick.com/plugin }; }, fixRGB = function (rgb) { + rgb.r = isNaN(rgb.r) ? 0 : rgb.r; + rgb.g = isNaN(rgb.g) ? 0 : rgb.g; + rgb.b = isNaN(rgb.b) ? 0 : rgb.b; return { r: Math.min(255, Math.max(0, rgb.r)), g: Math.min(255, Math.max(0, rgb.g)),