MCPcopy
hub / github.com/darkreader/darkreader / parseToHSLWithCache

Function parseToHSLWithCache

src/utils/color.ts:40–51  ·  view source on GitHub ↗
(color: string)

Source from the content-addressed store, hash-verified

38}
39
40export 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
53export function clearColorCache(): void {
54 hslaParseCache.clear();

Callers 1

modifyColorWithCacheFunction · 0.90

Calls 5

parseColorWithCacheFunction · 0.85
rgbToHSLFunction · 0.85
hasMethod · 0.65
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected