Skip to content

Commit

Permalink
fix: 🐛 Fix stringToHsl algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
dhnchandan committed Mar 22, 2023
1 parent c57f7ce commit bda38e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/algorithoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const stringToHsl = (c: string, alpha: boolean): HSL => {
else if (h.indexOf("rad") > -1) h = String(Math.round(Number(h.replace("rad", "")) * (180 / Math.PI)));
else if (h.indexOf("turn") > -1) h = String(Math.round(Number(h.replace("turn", "")) * 360));

return { h: Number(hsla[0]), s: Number(hsla[1]), l: Number(hsla[2]), a: hsla[3] ? Number(hsla[3]) : 1 };
return { h: Number(h), s: Number(s), l: Number(l), a: Number(a) };
};

export const stringToHex = (hex: string): HEX => {
Expand Down

0 comments on commit bda38e7

Please sign in to comment.