(cssColor: string, fallbackCssColor: string)
| 52 | }; |
| 53 | |
| 54 | const parseColor = (cssColor: string, fallbackCssColor: string): Rgba => { |
| 55 | const parsed = parseCssColorToRgba01(cssColor); |
| 56 | if (parsed) return [parsed[0], parsed[1], parsed[2], clamp01(parsed[3])] as const; |
| 57 | |
| 58 | const fb = parseCssColorToRgba01(fallbackCssColor); |
| 59 | if (fb) return [fb[0], fb[1], fb[2], clamp01(fb[3])] as const; |
| 60 | |
| 61 | return [0, 0, 0, 1] as const; |
| 62 | }; |
| 63 | |
| 64 | const parseNumberOrPercent = (value: number | string, basis: number): number | null => { |
| 65 | if (typeof value === 'number') return Number.isFinite(value) ? value : null; |
no test coverage detected