Technology
 

Validating a Color Code

From Unofficial Konfabulator Wiki

A simple function to validate a string and make sure it is a valid hex color code


function isColourCode(str) {
	objRegExp = /^\#[0-9A-Fa-f]{6}$/
	return objRegExp.test(str);
}

[edit] references

Rate this article: