mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
feat(themes): apply OpenCode color themes app-wide with a settings picker (#364)
- Vendor the 36 OpenCode theme palettes into the shared package, synced from the pinned OpenCode release tag via pnpm themes:sync. - Add a colorTheme user preference across the settings schema, defaults, and the assistant internal API. - Extend palettes with success, warning, info, and diff colors, and add a resolver that maps palettes to CSS tokens and applies them to the DOM. - Apply the theme app-wide through a ThemeProvider context, adopting the tokens in message, repo, session, and settings components, agent colors, git status styles, and diff viewers. - Add a theme picker to General settings and make model quick-select follow the active theme (fixes #355).
This commit is contained in:
1 parent
702e3c4e13
commit
5bd688de4b
116 files changed
+2702
-760
No files matched your search
@@ -13,6 +13,7 @@ import {
|
||||
ensureDirectoryExists,
|
||||
} from './file-operations'
|
||||
import { ASSISTANT_NOTIFICATION_LIMITS, OpenCodeConfigSchema } from '@opencode-manager/shared/schemas'
|
||||
import { MANAGER_COLOR_THEME_ID, OPENCODE_THEMES } from '@opencode-manager/shared/themes'
|
||||
import { ASSISTANT_REPO_ID, ASSISTANT_REPO_PATH, ASSISTANT_OPENCODE_DIR_NAME } from '@opencode-manager/shared/utils'
|
||||
import { getAssistantModePath, getReposPath } from '@opencode-manager/shared/config/env'
|
||||
import type { Database } from 'bun:sqlite'
|
||||
@@ -623,6 +624,7 @@ Retrieve the user's full settings, including all preferences.
|
||||
{
|
||||
preferences: {
|
||||
theme: 'dark' | 'light' | 'system',
|
||||
colorTheme?: string, // one of: ${[MANAGER_COLOR_THEME_ID, ...OPENCODE_THEMES.map((theme) => theme.id)].join(', ')}
|
||||
mode: 'plan' | 'build',
|
||||
defaultModel?: string,
|
||||
defaultAgent?: string,
|
||||
@@ -650,7 +652,7 @@ Update a subset of safe user preferences.
|
||||
|
||||
**Allowed Keys:**
|
||||
The following preference keys can be modified:
|
||||
- \`theme\`, \`mode\`, \`defaultModel\`, \`defaultAgent\`
|
||||
- \`theme\`, \`colorTheme\`, \`mode\`, \`defaultModel\`, \`defaultAgent\`
|
||||
- \`autoScroll\`, \`expandDiffs\`, \`expandToolCalls\`, \`showReasoning\`
|
||||
- \`simpleChatMode\`, \`leaderKey\`, \`directShortcuts\`
|
||||
- \`keyboardShortcuts\`, \`customCommands\`, \`notifications\`
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
UserPreferencesSchema,
|
||||
DEFAULT_USER_PREFERENCES,
|
||||
} from '../types/settings'
|
||||
import { isColorThemeId, MANAGER_COLOR_THEME_ID } from '@opencode-manager/shared/themes'
|
||||
|
||||
const CUSTOM_OPENCODE_SERVER_PASSWORD_KEY = 'opencode_server_password'
|
||||
const MANAGED_OPENCODE_SERVER_PASSWORD_KEY = 'opencode_server_managed_password'
|
||||
@@ -63,7 +64,11 @@ export class SettingsService {
|
||||
|
||||
try {
|
||||
const parsed = parseJsonc(row.preferences) as Record<string, unknown>
|
||||
|
||||
|
||||
if (!isColorThemeId(parsed.colorTheme)) {
|
||||
parsed.colorTheme = MANAGER_COLOR_THEME_ID
|
||||
}
|
||||
|
||||
const validated = UserPreferencesSchema.parse({
|
||||
...DEFAULT_USER_PREFERENCES,
|
||||
...parsed,
|
||||
|
||||
Reference in new issue
Block a user