MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / apply

Function apply

packages/app-core/src/App.tsx:423–436  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

421 const html = document.documentElement
422 const mql = window.matchMedia('(prefers-color-scheme: dark)')
423 const apply = (): void => {
424 const prefersDark = mql.matches
425 if (isCustomThemeId(themeId)) {
426 const slug = customThemeSlugFromId(themeId)
427 const theme = customThemes.find((t) => t.slug === slug)
428 const wantDark = themeMode === 'auto' ? prefersDark : themeMode === 'dark'
429 html.dataset.theme = themeId
430 html.dataset.themeMode = resolveCustomThemeMode(theme, wantDark)
431 } else {
432 const id = themeMode === 'auto' ? resolveAuto(themeFamily, prefersDark, themeId) : themeId
433 html.dataset.theme = id
434 html.dataset.themeMode = findTheme(id).mode
435 }
436 }
437 apply()
438 if (themeMode === 'auto') {
439 mql.addEventListener('change', apply)

Callers 1

AppFunction · 0.70

Calls 5

isCustomThemeIdFunction · 0.90
customThemeSlugFromIdFunction · 0.90
resolveCustomThemeModeFunction · 0.90
resolveAutoFunction · 0.90
findThemeFunction · 0.90

Tested by

no test coverage detected