From 1b616aff240f277663e1d092389fdf379966ace5 Mon Sep 17 00:00:00 2001 From: Zack Therrien Date: Thu, 12 Dec 2019 13:56:40 -0500 Subject: [PATCH] fix: use util isValidHex --- lib/graph3d/Settings.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/graph3d/Settings.js b/lib/graph3d/Settings.js index 786b4aa3e..45f6dd7b7 100755 --- a/lib/graph3d/Settings.js +++ b/lib/graph3d/Settings.js @@ -488,10 +488,8 @@ function setSurfaceColor(surfaceColors, dst) { let rgbColors = []; if(Array.isArray(surfaceColors)) { - // https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444 - const hexTestRegex = /^#([0-9A-F]{3}){1,2}$/i; rgbColors = surfaceColors.map(function(colorCode){ - if(!hexTestRegex.test(colorCode)) { + if(!util.isValidHex(colorCode)) { throw new Error('Invalid hex color code supplied to surfaceColors.'); } return util.hexToRGB(colorCode);