fix(common): pass radix 10 when parsing rgb() components in Color

rgba/rgb CSS parsing used parseInt without a radix on captured digit
groups. Add base 10 explicitly, matching getSafariVersion and other
call sites in the codebase.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-06-01 15:05:43 +00:00
committed by Cursor Agent
co-authored by Cursor
parent 6ebcf79358
commit f04679a42e
+3 -3
View File
@@ -177,9 +177,9 @@ export namespace css {
// Formats: rgb() or rgba()
const rgbaMatch = css.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
if (rgbaMatch) {
$r = parseInt(rgbaMatch[1]);
$g = parseInt(rgbaMatch[2]);
$b = parseInt(rgbaMatch[3]);
$r = parseInt(rgbaMatch[1], 10);
$g = parseInt(rgbaMatch[2], 10);
$b = parseInt(rgbaMatch[3], 10);
$a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);
return channels.toColor($r, $g, $b, $a);
}