From acdb9b4202c8a4e00adc7bd733d582e451366e92 Mon Sep 17 00:00:00 2001 From: STLighter Date: Tue, 14 Mar 2023 17:12:14 +0800 Subject: [PATCH] Fix support for `rgba(0, 0, 0, 0.6666)` (#12) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 2bdf9d6..cf6b894 100644 --- a/index.js +++ b/index.js @@ -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); }