(raw: string)
| 269 | * Parse a CSS color string into a ResolvedColor with RGB + WCAG luminance. |
| 270 | */ |
| 271 | export function parseColor(raw: string): ResolvedColor { |
| 272 | const parsed = parseCssColor(raw); |
| 273 | if (!parsed) { |
| 274 | throw new Error(`Invalid color: ${raw}`); |
| 275 | } |
| 276 | return { |
| 277 | type: 'color', |
| 278 | ...parsed, |
| 279 | }; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Parse a dimension string like "42px" or "1.5rem". |
no test coverage detected
searching dependent graphs…