Browse Source

Fixes color parser

main
Keith Daulton 1 year ago
parent
commit
f56154ede6
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/system/color.ts

+ 3
- 3
src/system/color.ts View File

@ -692,16 +692,16 @@ export function parseColor(value: string): Color | null {
return null;
}
const mode = result[3];
const mode = result[1];
let colors: number[];
switch (mode) {
case 'rgb':
case 'hsl':
colors = [parseInt(result[4], 10), parseInt(result[5], 10), parseInt(result[6], 10), 1];
colors = [parseInt(result[2], 10), parseInt(result[3], 10), parseInt(result[4], 10), 1];
break;
case 'rgba':
case 'hsla':
colors = [parseInt(result[4], 10), parseInt(result[5], 10), parseInt(result[6], 10), parseFloat(result[7])];
colors = [parseInt(result[2], 10), parseInt(result[3], 10), parseInt(result[4], 10), parseFloat(result[5])];
break;
default:
return null;

Loading…
Cancel
Save