diff options
| author | Luke Parker <[email protected]> | 2026-04-19 19:46:34 +1000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-19 19:46:34 +1000 |
| commit | 10bd044c55600408f2bca606bb6ce37c88b459f9 (patch) | |
| tree | 21142e75094316dd82389f7c32d299f0491d472e /packages/app/src/context | |
| parent | c09bcfe5314ff4d78d169a9a373450d19df9b407 (diff) | |
| download | opencode-10bd044c55600408f2bca606bb6ce37c88b459f9.tar.gz opencode-10bd044c55600408f2bca606bb6ce37c88b459f9.zip | |
feat: add terminal font settings and built-in Nerd Font (#23391)
Diffstat (limited to 'packages/app/src/context')
| -rw-r--r-- | packages/app/src/context/settings.tsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/app/src/context/settings.tsx b/packages/app/src/context/settings.tsx index a585789ce..3012f099e 100644 --- a/packages/app/src/context/settings.tsx +++ b/packages/app/src/context/settings.tsx @@ -39,6 +39,7 @@ export interface Settings { fontSize: number mono: string sans: string + terminal: string } keybinds: Record<string, string> permissions: { @@ -50,13 +51,16 @@ export interface Settings { export const monoDefault = "System Mono" export const sansDefault = "System Sans" +export const terminalDefault = "JetBrainsMono Nerd Font Mono" const monoFallback = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace' const sansFallback = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif' +const terminalFallback = '"JetBrainsMono Nerd Font Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace' const monoBase = monoFallback const sansBase = sansFallback +const terminalBase = terminalFallback function input(font: string | undefined) { return font ?? "" @@ -89,6 +93,14 @@ export function sansFontFamily(font: string | undefined) { return stack(font, sansBase) } +export function terminalInput(font: string | undefined) { + return input(font) +} + +export function terminalFontFamily(font: string | undefined) { + return stack(font, terminalBase) +} + const defaultSettings: Settings = { general: { autoSave: true, @@ -110,6 +122,7 @@ const defaultSettings: Settings = { fontSize: 14, mono: "", sans: "", + terminal: "", }, keybinds: {}, permissions: { @@ -233,6 +246,10 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont setUIFont(value: string) { setStore("appearance", "sans", value.trim() ? value : "") }, + terminalFont: withFallback(() => store.appearance?.terminal, defaultSettings.appearance.terminal), + setTerminalFont(value: string) { + setStore("appearance", "terminal", value.trim() ? value : "") + }, }, keybinds: { get: (action: string) => store.keybinds?.[action], |
