From 1469f2b102df890ab020f16d06c33f3562c4445f Mon Sep 17 00:00:00 2001 From: xavier Date: Mon, 20 Mar 2017 16:30:33 -0400 Subject: [PATCH] Fix toHex regex first test --- js/jquery.colorPicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.colorPicker.js b/js/jquery.colorPicker.js index 72b38b1..7b22da6 100644 --- a/js/jquery.colorPicker.js +++ b/js/jquery.colorPicker.js @@ -170,7 +170,7 @@ **/ toHex : function (color) { // If we have a standard or shorthand Hex color, return that value. - if (color.match(/[0-9A-F]{6}|[0-9A-F]{3}$/i)) { + if (color.match(/^(#?)[0-9A-F]{6}$/i) || color.match(/^(#?)[0-9A-F]{3}$/i)) { return (color.charAt(0) === "#") ? color : ("#" + color); // Alternatively, check for RGB color, then convert and return it as Hex.