MCPcopy Index your code
hub / github.com/darkreader/darkreader / getScrollbarColorModifier

Function getScrollbarColorModifier

src/inject/dynamic-theme/modify-css.ts:729–743  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

727}
728
729export function getScrollbarColorModifier(value: string): string | CSSValueModifier | null {
730 const colorsMatch = value.match(/^\s*([a-z]+(\(.*\))?)\s+([a-z]+(\(.*\))?)\s*$/);
731 if (!colorsMatch) {
732 return value;
733 }
734
735 const thumb = parseColorWithCache(colorsMatch[1]);
736 const track = parseColorWithCache(colorsMatch[3]);
737 if (!thumb || !track) {
738 logWarn("Couldn't parse color", ...([thumb, track].filter((c) => !c)));
739 return null;
740 }
741
742 return (theme) => `${modifyForegroundColor(thumb, theme)} ${modifyBackgroundColor(track, theme)}`;
743}
744
745export function getColorSchemeModifier(): CSSValueModifier {
746 return (theme: Theme) => theme.mode === 0 ? 'dark light' : 'dark';

Callers 1

Calls 4

parseColorWithCacheFunction · 0.90
logWarnFunction · 0.90
modifyForegroundColorFunction · 0.90
modifyBackgroundColorFunction · 0.90

Tested by

no test coverage detected