MCPcopy
hub / github.com/darkreader/darkreader / modifyAndRegisterColor

Function modifyAndRegisterColor

src/inject/dynamic-theme/modify-colors.ts:96–108  ·  view source on GitHub ↗
(
    type: 'background' | 'text' | 'border',
    rgb: RGBA,
    theme: Theme,
    modifier: (rgb: RGBA, theme: Theme) => string,
)

Source from the content-addressed store, hash-verified

94}
95
96function modifyAndRegisterColor(
97 type: 'background' | 'text' | 'border',
98 rgb: RGBA,
99 theme: Theme,
100 modifier: (rgb: RGBA, theme: Theme) => string,
101) {
102 const registered = getRegisteredColor(type, rgb);
103 if (registered) {
104 return registered;
105 }
106 const value = modifier(rgb, theme);
107 return registerColor(type, rgb, value);
108}
109
110function modifyLightSchemeColor(rgb: RGBA, theme: Theme): string {
111 const poleBg = getBgPole(theme);

Callers 3

modifyBackgroundColorFunction · 0.85
modifyForegroundColorFunction · 0.85
modifyBorderColorFunction · 0.85

Calls 2

getRegisteredColorFunction · 0.90
registerColorFunction · 0.90

Tested by

no test coverage detected