(color: string)
| 38 | } |
| 39 | |
| 40 | export function parseToHSLWithCache(color: string): HSLA | null { |
| 41 | if (hslaParseCache.has(color)) { |
| 42 | return hslaParseCache.get(color)!; |
| 43 | } |
| 44 | const rgb = parseColorWithCache(color); |
| 45 | if (!rgb) { |
| 46 | return null; |
| 47 | } |
| 48 | const hsl = rgbToHSL(rgb); |
| 49 | hslaParseCache.set(color, hsl); |
| 50 | return hsl; |
| 51 | } |
| 52 | |
| 53 | export function clearColorCache(): void { |
| 54 | hslaParseCache.clear(); |
no test coverage detected