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

Function auto

src/api/index.ts:56–73  ·  view source on GitHub ↗
(themeOptions: Partial<Theme> | false = {}, fixes: DynamicThemeFix | null = null)

Source from the content-addressed store, hash-verified

54}
55
56export function auto(themeOptions: Partial<Theme> | false = {}, fixes: DynamicThemeFix | null = null): void {
57 if (themeOptions) {
58 store = {themeOptions, fixes};
59 handleColorScheme();
60 if (isMatchMediaChangeEventListenerSupported) {
61 darkScheme?.addEventListener('change', handleColorScheme);
62 } else {
63 darkScheme?.addListener(handleColorScheme);
64 }
65 } else {
66 if (isMatchMediaChangeEventListenerSupported) {
67 darkScheme?.removeEventListener('change', handleColorScheme);
68 } else {
69 darkScheme?.removeListener(handleColorScheme);
70 }
71 disable();
72 }
73}
74
75export async function exportGeneratedCSS(): Promise<string> {
76 return await collectCSS();

Callers

nothing calls this directly

Calls 3

handleColorSchemeFunction · 0.85
disableFunction · 0.85
addListenerMethod · 0.45

Tested by

no test coverage detected