Skip to content

Commit

Permalink
Fix support for rgba(0, 0, 0, 0.6666) (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
STLighter committed Mar 14, 2023
1 parent 2c4f9da commit acdb9b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -2,7 +2,7 @@ export default function rgbHex(red, green, blue, alpha) {
const isPercent = (red + (alpha || '')).toString().includes('%');

if (typeof red === 'string') {
[red, green, blue, alpha] = red.match(/(0?\.?\d{1,3})%?\b/g).map(component => Number(component));
[red, green, blue, alpha] = red.match(/(0?\.?\d+)%?\b/g).map(component => Number(component));
} else if (alpha !== undefined) {
alpha = Number.parseFloat(alpha);
}
Expand Down

0 comments on commit acdb9b4

Please sign in to comment.