Skip to content

Instantly share code, notes, and snippets.

@kugimiya
Created September 10, 2018 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kugimiya/7b2e4d3bc794d88918dd1f2f23065ec8 to your computer and use it in GitHub Desktop.
Save kugimiya/7b2e4d3bc794d88918dd1f2f23065ec8 to your computer and use it in GitHub Desktop.
diff --git a/js/tygh/core.js b/js/tygh/core.js
index b3363ec28c..1d6ef44b73 100644
--- a/js/tygh/core.js
+++ b/js/tygh/core.js
@@ -127,9 +127,21 @@ var Tygh = {
return (/^[0-9]+$/.test(val) && !$.is.blank(val)) ? true : false;
},
+ rgbColor: function (val) {
+ return (/^(rgb)\((\d*)(,|, *)(\d*)(,|, *)(\d*)\)$/.test(val));
+ },
+
+ rgbaColor: function (val) {
+ return (/^(rgba)\((\d*)(,|, *)(\d*)(,|, *)(\d*)(,|, *)(\d*|\d.\d*)\)$/.test(val));
+ },
+
+ hex6Color: function (val) {
+ return (/^\#[0-9a-fA-F]{6}$/.test(val));
+ },
+
color: function(val)
{
- return (/^\#[0-9a-fA-F]{6}$/.test(val) && !$.is.blank(val)) ? true : false;
+ return ($.is.rgbColor(val) || $.is.rgbaColor(val) || $.is.hex6Color(val));
},
phone: function(val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment