From 9812ecfe103914e0b58be4423248810ce751dc8d Mon Sep 17 00:00:00 2001 From: Julian Toledo Date: Thu, 9 Mar 2017 09:49:00 -0500 Subject: [PATCH] Urgent fix in color parsing --- views/helpers/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/views/helpers/index.js b/views/helpers/index.js index f8d75170..bf404ac4 100644 --- a/views/helpers/index.js +++ b/views/helpers/index.js @@ -26,12 +26,10 @@ function contrastColor(hexcolor) { return DEFAULT_LIGHT; } - // Assume that a 6 digit string is a color. - if (hexcolor.length === 6 && hexcolor[0] !== '#') { - hexcolor = '#' + hexcolor; - } - const parsedColor = parseColor(hexcolor); + if (!parsedColor) { + return DEFAULT_LIGHT; + } const r = parsedColor.rgb[0]; const g = parsedColor.rgb[1]; const b = parsedColor.rgb[2];