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

Function applyTheme

packages/app-core/src/components/QuickCaptureApp.tsx:140–169  ·  view source on GitHub ↗
(prefs: QuickCapturePrefs)

Source from the content-addressed store, hash-verified

138])
139
140function applyTheme(prefs: QuickCapturePrefs): void {
141 const html = document.documentElement
142 const mql = window.matchMedia('(prefers-color-scheme: dark)')
143 let id = prefs.themeId
144 if (prefs.themeMode === 'auto') id = resolveAuto(prefs.themeFamily, mql.matches, prefs.themeId)
145 if (!THEMES.some((t) => t.id === id)) id = DEFAULT_THEME_ID
146 html.dataset.theme = id
147 html.style.setProperty('--z-editor-font-size', `${prefs.editorFontSize}px`)
148 html.style.setProperty('--z-editor-line-height', String(prefs.editorLineHeight))
149 const setFont = (name: string, value: string | null, fallback: string): void => {
150 if (value) html.style.setProperty(name, `"${value}", ${fallback}`)
151 else html.style.removeProperty(name)
152 }
153 setFont(
154 '--z-interface-font',
155 prefs.interfaceFont,
156 '-apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif'
157 )
158 setFont(
159 '--z-text-font',
160 prefs.textFont,
161 '"SF Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace'
162 )
163 setFont(
164 '--z-mono-font',
165 prefs.monoFont,
166 '"SF Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace'
167 )
168 html.setAttribute('data-opaque', '')
169}
170
171type EditingMode =
172 | { kind: 'new' }

Callers 2

QuickCaptureAppFunction · 0.70
onChangeFunction · 0.70

Calls 2

resolveAutoFunction · 0.90
setFontFunction · 0.70

Tested by

no test coverage detected