(prefs: QuickCapturePrefs)
| 138 | ]) |
| 139 | |
| 140 | function 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 | |
| 171 | type EditingMode = |
| 172 | | { kind: 'new' } |
no test coverage detected