Skip to content

Commit

Permalink
fix: parse alpha value of hex format (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaij authored May 30, 2022
1 parent 4a91a88 commit 1a76bc1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ export function parseColor(val: string): RGBAColor {
g = parseInt(val.charAt(3) + val.charAt(4), 16);
b = parseInt(val.charAt(5) + val.charAt(6), 16);
}

// TODO: parse hex with alpha?
if (val.length === 9) {
a = parseInt(val.charAt(7) + val.charAt(8), 16) / 255;
}
}

// Handling rgb notation
Expand Down

0 comments on commit 1a76bc1

Please sign in to comment.