diff --git a/frontend/src/contexts/ThemeContext.tsx b/frontend/src/contexts/ThemeContext.tsx
index 068bf8b7..0a7699b2 100644
--- a/frontend/src/contexts/ThemeContext.tsx
+++ b/frontend/src/contexts/ThemeContext.tsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import { useSettings } from '@/hooks/useSettings'
import { useAuth } from '@/hooks/useAuth'
-import { applyColorTheme, getDocumentThemeMode, type ThemeMode } from '@/lib/theme/colorTheme'
+import { applyColorTheme, applyFontSize, getDocumentThemeMode, type ThemeMode } from '@/lib/theme/colorTheme'
import { ThemeContext } from './theme-context'
export function ThemeProvider({ children }: { children: React.ReactNode }) {
@@ -11,6 +11,13 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
const hasPreferences = preferences !== undefined
const theme = preferences?.theme || 'dark'
const colorTheme = preferences?.colorTheme
+ const fontSize = preferences?.fontSize
+
+ useEffect(() => {
+ if (!hasPreferences) return
+
+ applyFontSize(document.documentElement, fontSize)
+ }, [hasPreferences, fontSize])
useEffect(() => {
if (!hasPreferences) return
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 5a079e85..d3fcf43c 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -403,12 +403,12 @@ body {
input[type="url"],
textarea,
select {
- font-size: 16px !important;
+ font-size: max(16px, 1rem) !important;
}
/* ContentEditable elements */
[contenteditable="true"] {
- font-size: 16px !important;
+ font-size: max(16px, 1rem) !important;
}
}
diff --git a/frontend/src/lib/theme/colorTheme.test.ts b/frontend/src/lib/theme/colorTheme.test.ts
index 9f170ec1..2b5d3bd6 100644
--- a/frontend/src/lib/theme/colorTheme.test.ts
+++ b/frontend/src/lib/theme/colorTheme.test.ts
@@ -3,7 +3,9 @@ import { beforeEach, describe, expect, it } from 'vitest'
import {
APPEARANCE_STORAGE_KEY,
AppearanceSnapshotSchema,
+ FONT_SIZE_STORAGE_KEY,
applyColorTheme,
+ applyFontSize,
readableTextColor,
resolveColorThemeTokens,
} from './colorTheme'
@@ -148,3 +150,28 @@ describe('applyColorTheme', () => {
expect(indexHtml).toContain(APPEARANCE_STORAGE_KEY)
})
})
+
+describe('applyFontSize', () => {
+ beforeEach(() => {
+ document.documentElement.removeAttribute('style')
+ window.localStorage.clear()
+ })
+
+ it('applies the scale to the root element and persists it for boot replay', () => {
+ applyFontSize(document.documentElement, 'large')
+
+ expect(document.documentElement.style.fontSize).toBe('112.5%')
+ expect(window.localStorage.getItem(FONT_SIZE_STORAGE_KEY)).toBe('112.5%')
+ })
+
+ it('falls back to the default scale when no preference is set', () => {
+ applyFontSize(document.documentElement, undefined)
+
+ expect(document.documentElement.style.fontSize).toBe('100%')
+ expect(window.localStorage.getItem(FONT_SIZE_STORAGE_KEY)).toBe('100%')
+ })
+
+ it('keeps the boot replay storage key in sync with index.html', () => {
+ expect(indexHtml).toContain(FONT_SIZE_STORAGE_KEY)
+ })
+})
diff --git a/frontend/src/lib/theme/colorTheme.ts b/frontend/src/lib/theme/colorTheme.ts
index 4be5835f..fb9b9a2f 100644
--- a/frontend/src/lib/theme/colorTheme.ts
+++ b/frontend/src/lib/theme/colorTheme.ts
@@ -1,6 +1,7 @@
import { z } from 'zod'
import { getOpenCodeTheme, MANAGER_COLOR_THEME_ID } from '@opencode-manager/shared/themes'
import type { ColorThemeId, HexColor } from '@opencode-manager/shared/themes'
+import type { FontSize } from '@opencode-manager/shared/schemas'
const MANAGER_THEME_TOKENS = [
'background',
@@ -54,6 +55,15 @@ export type ThemeMode = 'light' | 'dark'
export const APPEARANCE_STORAGE_KEY = 'ocm-appearance'
+export const FONT_SIZE_STORAGE_KEY = 'ocm-font-size'
+
+const FONT_SIZE_SCALE: Record = {
+ small: '87.5%',
+ medium: '100%',
+ large: '112.5%',
+ xlarge: '125%',
+}
+
export const AppearanceSnapshotSchema = z.object({
dark: z.boolean(),
tokens: z.record(z.string(), z.string()).nullable(),
@@ -165,14 +175,18 @@ export function resolveColorThemeTokens(
}
}
-function persistAppearance(snapshot: AppearanceSnapshot): void {
+function persistStorageValue(key: string, value: string): void {
try {
- window.localStorage.setItem(APPEARANCE_STORAGE_KEY, JSON.stringify(snapshot))
+ window.localStorage.setItem(key, value)
} catch {
return
}
}
+function persistAppearance(snapshot: AppearanceSnapshot): void {
+ persistStorageValue(APPEARANCE_STORAGE_KEY, JSON.stringify(snapshot))
+}
+
export function applyColorTheme(
root: HTMLElement,
colorTheme: ColorThemeId | undefined,
@@ -196,3 +210,10 @@ export function applyColorTheme(
persistAppearance({ dark: isDark, tokens: resolved, themeColor })
}
+
+export function applyFontSize(root: HTMLElement, fontSize: FontSize | undefined): void {
+ const scale = FONT_SIZE_SCALE[fontSize ?? 'medium']
+
+ root.style.fontSize = scale
+ persistStorageValue(FONT_SIZE_STORAGE_KEY, scale)
+}
diff --git a/shared/src/schemas/internal-assistant.ts b/shared/src/schemas/internal-assistant.ts
index 23c183b5..e31a3d9d 100644
--- a/shared/src/schemas/internal-assistant.ts
+++ b/shared/src/schemas/internal-assistant.ts
@@ -102,6 +102,7 @@ export const AssistantSTTPatchSchema = z.object({
export const AssistantSettingsPatchSchema = UserPreferencesSchema.pick({
theme: true,
colorTheme: true,
+ fontSize: true,
mode: true,
defaultModel: true,
walkthroughModel: true,
diff --git a/shared/src/schemas/settings.ts b/shared/src/schemas/settings.ts
index ace5ff1b..a850f9d7 100644
--- a/shared/src/schemas/settings.ts
+++ b/shared/src/schemas/settings.ts
@@ -199,6 +199,10 @@ export const DEFAULT_SESSION_DEFAULTS = {
permissionMode: 'ask',
} satisfies SessionDefaults;
+export const FontSizeSchema = z.enum(['small', 'medium', 'large', 'xlarge']);
+
+export type FontSize = z.infer;
+
export const DevicePairingPreferencesSchema = z.object({
allowPrivateNetworkHttp: z.boolean().optional(),
});
@@ -208,6 +212,7 @@ export type DevicePairingPreferences = z.infer