MCPcopy
hub / github.com/darkreader/darkreader / createOrUpdateDynamicTheme

Function createOrUpdateDynamicTheme

src/inject/dynamic-theme/index.ts:669–677  ·  view source on GitHub ↗
(theme: Theme, dynamicThemeFixes: DynamicThemeFix[] | null, iframe: boolean)

Source from the content-addressed store, hash-verified

667 * TODO: expose this function to API builds via src/api function enable()
668 */
669export function createOrUpdateDynamicTheme(theme: Theme, dynamicThemeFixes: DynamicThemeFix[] | null, iframe: boolean): void {
670 const dynamicThemeFix = selectRelevantFix(document.location.href, dynamicThemeFixes);
671
672 // Most websites will have only the generic fix applied ('*'), some will have generic fix and one site-specific fix (two in total),
673 // and very few will have multiple site-specific fixes
674 // TODO: add a navigation listener here for this case
675
676 createOrUpdateDynamicThemeInternal(theme, dynamicThemeFix, iframe);
677}
678
679let prevTheme: Theme | null = null;
680let prevFixes: DynamicThemeFix | null = null;

Callers 10

onMessageFunction · 0.90
color.tests.tsFile · 0.90
fixes.tests.tsFile · 0.90
variables.tests.tsFile · 0.90

Calls 2

selectRelevantFixFunction · 0.85

Tested by

no test coverage detected