Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

short colors added

  • Loading branch information...
commit 175f07661358544ea83a603977bed449cb5c472d 1 parent 1902e4e
@apsavin authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 privateFunctions/private.js
View
14 privateFunctions/private.js
@@ -306,9 +306,17 @@ function parseColor(color)
}
if(color.charAt(0)=='#')
{
- colorKeeper.r=parseInt(color.substr(1,2),16);
- colorKeeper.g=parseInt(color.substr(3,2),16);
- colorKeeper.b=parseInt(color.substr(5,2),16);
+ if (color.length > 4) {
+ colorKeeper.r = parseInt(color.substr(1, 2), 16);
+ colorKeeper.g = parseInt(color.substr(3, 2), 16);
+ colorKeeper.b = parseInt(color.substr(5, 2), 16);
+ }
+ else {
+ var r = color.charAt(1), g = color.charAt(2), b = color.charAt(3);
+ colorKeeper.r = parseInt(r + r, 16);
+ colorKeeper.g = parseInt(g + g, 16);
+ colorKeeper.b = parseInt(b + b, 16);
+ }
}
else
{
Please sign in to comment.
Something went wrong with that request. Please try again.