]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Update color regex pattern to support other values also
authorHarry Manchanda <harmanmanchanda182@gmail.com>
Mon, 28 Aug 2017 12:52:12 +0000 (18:22 +0530)
committerGitHub <noreply@github.com>
Mon, 28 Aug 2017 12:52:12 +0000 (18:22 +0530)
Now its Hex (#FFF or #FFFFFF) || RGB || RGBA || HSL || HSLA
Closes #10588 on merge

js/foundation.abide.js

index d6ad376962506222b67b9f66f52f539ec9804d13..3f793078b85f13c1c5aa521f7b36324a8d4b39d7 100644 (file)
@@ -558,8 +558,8 @@ Abide.defaults = {
     // DD/MM/YYYY
     day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
 
-    // #FFF or #FFFFFF
-    color : /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
+    // Hex (#FFF or #FFFFFF) || RGB || RGBA || HSL || HSLA
+    color : /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,
 
     // Domain || URL
     website: {