Merge pull request #144 from beeglebug/dev

hexToRGB now accepts short hex codes (#EEE)
This commit is contained in:
Richard Davey
2013-10-30 07:16:41 -07:00
+5
View File
@@ -48,6 +48,11 @@ Phaser.Color = {
hexToRGB: function (h) {
var hex16 = (h.charAt(0) == "#") ? h.substring(1, 7) : h;
if (hex16.length==3) {
hex16 = hex16.charAt(0) + hex16.charAt(0) + hex16.charAt(1) + hex16.charAt(1) + hex16.charAt(2) + hex16.charAt(2);
}
var red = parseInt(hex16.substring(0, 2), 16);
var green = parseInt(hex16.substring(2, 4), 16);
var blue = parseInt(hex16.substring(4, 6), 16);