mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +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
@@ -31,23 +31,6 @@ const findAgent = (agents: AgentInfo[], agentId: string): AgentInfo | undefined
|
||||
return agents.find(a => a.id.toLowerCase() === agentId.toLowerCase())
|
||||
}
|
||||
|
||||
const bashStyleVars: Record<string, string> = {
|
||||
'--agent-color-light': '#a753ae',
|
||||
'--agent-color-dark': '#edb2f1',
|
||||
'--agent-bg-light': 'rgba(167, 83, 174, 0.2)',
|
||||
'--agent-bg-dark': 'rgba(237, 178, 241, 0.2)',
|
||||
'--agent-bg-hover-light': 'rgba(167, 83, 174, 0.3)',
|
||||
'--agent-bg-hover-dark': 'rgba(237, 178, 241, 0.3)',
|
||||
'--agent-border-light': 'rgba(167, 83, 174, 0.6)',
|
||||
'--agent-border-dark': 'rgba(237, 178, 241, 0.6)',
|
||||
'--agent-border-hover-light': 'rgba(167, 83, 174, 0.5)',
|
||||
'--agent-border-hover-dark': 'rgba(237, 178, 241, 0.5)',
|
||||
'--agent-shadow-light': 'rgba(167, 83, 174, 0.2)',
|
||||
'--agent-shadow-dark': 'rgba(237, 178, 241, 0.2)',
|
||||
'--agent-shadow-hover-light': 'rgba(167, 83, 174, 0.3)',
|
||||
'--agent-shadow-hover-dark': 'rgba(237, 178, 241, 0.3)',
|
||||
}
|
||||
|
||||
export function AgentQuickSelect({
|
||||
directory,
|
||||
currentAgent,
|
||||
@@ -70,7 +53,7 @@ export function AgentQuickSelect({
|
||||
|
||||
const currentAgentInfo = findAgent(agents, currentAgent)
|
||||
const styleVars = isBashMode
|
||||
? bashStyleVars
|
||||
? getAgentStyleVars('plan')
|
||||
: getAgentStyleVars(currentAgent, currentAgentInfo?.color)
|
||||
const displayName = isBashMode ? 'Bash' : capitalize(currentAgentInfo?.name ?? currentAgent)
|
||||
|
||||
@@ -78,7 +61,7 @@ export function AgentQuickSelect({
|
||||
<button
|
||||
data-toggle-mode
|
||||
style={styleVars as React.CSSProperties}
|
||||
className="px-2 md:px-3.5 py-1 h-[36px] rounded-lg text-sm font-medium border min-w-[56px] max-w-[80px] md:max-w-[100px] flex-shrink-0 flex items-center justify-center transition-all duration-200 active:scale-95 hover:scale-105 shadow-md text-[var(--agent-color-light)] dark:text-[var(--agent-color-dark)] bg-[var(--agent-bg-light)] dark:bg-[var(--agent-bg-dark)] border-[var(--agent-border-light)] dark:border-[var(--agent-border-dark)] hover:bg-[var(--agent-bg-hover-light)] dark:hover:bg-[var(--agent-bg-hover-dark)] hover:border-[var(--agent-border-hover-light)] dark:hover:border-[var(--agent-border-hover-dark)] shadow-[var(--agent-shadow-light)] dark:shadow-[var(--agent-shadow-dark)] hover:shadow-[var(--agent-shadow-hover-light)] dark:hover:shadow-[var(--agent-shadow-hover-dark)]"
|
||||
className="px-2 md:px-3.5 py-1 h-[36px] rounded-lg text-sm font-medium border min-w-[56px] max-w-[80px] md:max-w-[100px] flex-shrink-0 flex items-center justify-center transition-all duration-200 active:scale-95 hover:scale-105 shadow-md text-[var(--agent-color)] bg-[var(--agent-bg)] border-[var(--agent-border)] hover:bg-[var(--agent-bg-hover)] hover:border-[var(--agent-border-hover)] shadow-[var(--agent-shadow)] hover:shadow-[var(--agent-shadow-hover)]"
|
||||
>
|
||||
<span className="truncate">{displayName}</span>
|
||||
</button>
|
||||
@@ -104,7 +87,7 @@ export function AgentQuickSelect({
|
||||
<div className="flex flex-col min-w-0">
|
||||
<span
|
||||
className="font-medium"
|
||||
style={{ color: itemStyleVars['--agent-color-light'] }}
|
||||
style={{ color: itemStyleVars['--agent-color'] }}
|
||||
>
|
||||
{capitalize(agent.name)}
|
||||
</span>
|
||||
|
||||
Reference in new issue
Block a user