Global.String.prototype.isHexColor ()
function checks a string for a valid color value in hexadecimal format. it may also contain # as first character

  • Returns
    Boolean false, if string length (without #) > 6 or < 6 or contains any character which is not a valid hex value
Sourcecode in /home/hannes/helma/modules/core/String.js:
209:   String.prototype.isHexColor = function() {
210:       var str = this;
211:       if (this.indexOf("#") == 0)
212:           str = this.substring(1);
213:       if (str.length != 6)
214:           return false;
215:       return !String.HEXPATTERN.test(str);
216:   }