Skip to content

Commit

Permalink
Urgent fix in color parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
juliantoledo committed Mar 9, 2017
1 parent b884637 commit 9812ecf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions views/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ function contrastColor(hexcolor) {
return DEFAULT_LIGHT;
}

// Assume that a 6 digit string is a color.
if (hexcolor.length === 6 && hexcolor[0] !== '#') {
hexcolor = '#' + hexcolor;
}

const parsedColor = parseColor(hexcolor);
if (!parsedColor) {
return DEFAULT_LIGHT;
}
const r = parsedColor.rgb[0];
const g = parsedColor.rgb[1];
const b = parsedColor.rgb[2];
Expand Down

0 comments on commit 9812ecf

Please sign in to comment.