Created
March 2, 2009 08:44
-
-
Save phac/72671 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parse_color_str = function(color_str){ | |
var matches = color_str.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i); | |
if(!matches) return {r:0xff, g:0xff, b:0xff}; | |
return { | |
r : parseInt(matches[1], 16), | |
g : parseInt(matches[2], 16), | |
b : parseInt(matches[3], 16) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment