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:
Chris Scott authored and GitHub committed 2026-09-28 00:19:32 -04:00
1 parent 702e3c4e13
commit 5bd688de4b
116 files changed
+2702 -760

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ export function BackButton({ to = "/", className = "" }: BackButtonProps) {
<button
onClick={handleBack}
aria-label="Go back"
className={`text-zinc-400 hover:text-zinc-100 transition-all duration-200 hover:scale-105 text-sm md:text-md border border-zinc-700 rounded-md px-3 py-1.5 hover ${className}`}
className={`text-muted-foreground hover:text-foreground transition-all duration-200 hover:scale-105 text-sm md:text-md border border-border rounded-md px-3 py-1.5 hover ${className}`}
>
<ArrowLeft className="w-4 h-4" />
</button>
+1 -1
View File
@@ -11,7 +11,7 @@ const buttonVariants = cva(
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
+2 -2
View File
@@ -94,8 +94,8 @@ const EditorRow = memo(function EditorRow({
data-active-match={h.first && h.index === activeHighlightIndex ? 'true' : undefined}
className={
h.index === activeHighlightIndex
? 'rounded-sm bg-orange-400 text-black'
: 'rounded-sm bg-yellow-300/60 text-black'
? 'rounded-sm bg-highlight text-highlight-foreground'
: 'rounded-sm bg-warning/60 text-warning-foreground'
}
>
{line.substring(h.start, h.end)}
@@ -59,7 +59,7 @@ export function ConfirmDestructiveDialog({
variant="destructive"
onClick={onConfirm}
disabled={isPending}
className="flex-1 sm:flex-none bg-red-600 hover:bg-red-700 text-white font-semibold border-red-600"
className="flex-1 sm:flex-none bg-destructive hover:bg-destructive/90 text-destructive-foreground font-semibold border-destructive"
>
{isPending && pendingLabel ? pendingLabel : confirmLabel}
</Button>
+2 -2
View File
@@ -64,9 +64,9 @@ export function CopyButton({
title={copied ? 'Copied!' : title}
>
{copied ? (
<Check className={cn(sizeClasses, 'text-green-500')} />
<Check className={cn(sizeClasses, 'text-success')} />
) : (
<Copy className={cn(sizeClasses, copied && 'text-green-500')} />
<Copy className={cn(sizeClasses, copied && 'text-success')} />
)}
</button>
)
+1 -1
View File
@@ -16,7 +16,7 @@ export function ErrorBanner({ title, summary, detail, onDismiss, className }: Er
<Alert className={cn('bg-card border-border border-l-[3px] border-l-destructive', className)}>
<div className="flex flex-col gap-2">
<div className="flex items-start gap-2">
<AlertCircle className="h-4 w-4 mt-0.5 flex-shrink-0 text-red-400" />
<AlertCircle className="h-4 w-4 mt-0.5 flex-shrink-0 text-destructive" />
<div className="flex-1 min-w-0">
{title && (
<AlertTitle className="mb-1 font-medium leading-none tracking-tight text-foreground">{title}</AlertTitle>
@@ -6,14 +6,14 @@ type BadgeColor = 'orange' | 'blue'
const colorStyles: Record<BadgeColor, { bg: string; hover: string; text: string }> = {
orange: {
bg: 'bg-orange-500/10',
hover: 'hover:bg-orange-500/20',
text: 'text-orange-500',
bg: 'bg-highlight/10',
hover: 'hover:bg-highlight/20',
text: 'text-highlight',
},
blue: {
bg: 'bg-blue-500/10',
hover: 'hover:bg-blue-500/20',
text: 'text-blue-500',
bg: 'bg-info/10',
hover: 'hover:bg-info/20',
text: 'text-info',
},
}
@@ -56,7 +56,7 @@ export function PendingActionBadge({
<span
className={cn(
'absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full animate-pulse',
color === 'orange' ? 'bg-orange-500' : 'bg-blue-500'
color === 'orange' ? 'bg-highlight' : 'bg-info'
)}
/>
</Button>
@@ -77,23 +77,23 @@ export const SessionStatusIndicator = memo(function SessionStatusIndicator({
const intensity = Math.max(0, 1 - distance / (maxDistance + 2))
if (statusType === 'retry') {
if (intensity > 0.8) return 'bg-amber-500'
if (intensity > 0.5) return 'bg-amber-500/70'
if (intensity > 0.2) return 'bg-amber-500/40'
return 'bg-amber-500/20'
if (intensity > 0.8) return 'bg-warning'
if (intensity > 0.5) return 'bg-warning/70'
if (intensity > 0.2) return 'bg-warning/40'
return 'bg-warning/20'
}
if (statusType === 'compact') {
if (intensity > 0.8) return 'bg-purple-500'
if (intensity > 0.5) return 'bg-purple-500/70'
if (intensity > 0.2) return 'bg-purple-500/40'
return 'bg-purple-500/20'
if (intensity > 0.8) return 'bg-primary'
if (intensity > 0.5) return 'bg-primary/70'
if (intensity > 0.2) return 'bg-primary/40'
return 'bg-primary/20'
}
if (intensity > 0.8) return 'bg-blue-500'
if (intensity > 0.5) return 'bg-blue-500/70'
if (intensity > 0.2) return 'bg-blue-500/40'
return 'bg-blue-500/20'
if (intensity > 0.8) return 'bg-info'
if (intensity > 0.5) return 'bg-info/70'
if (intensity > 0.2) return 'bg-info/40'
return 'bg-info/20'
}
const segmentClass = size === 'sm' ? 'w-0.5 h-2' : 'w-1 h-4'
@@ -112,7 +112,7 @@ export const SessionStatusIndicator = memo(function SessionStatusIndicator({
{showLabel && status.type === 'retry' && (
<span className="text-xs text-muted-foreground">
Retry #{status.attempt}
{retryCountdown > 0 && <span className="text-amber-500 ml-1">({retryCountdown}s)</span>}
{retryCountdown > 0 && <span className="text-warning ml-1">({retryCountdown}s)</span>}
</span>
)}
</div>
+2 -2
View File
@@ -62,7 +62,7 @@ export function SettingsList({
if (isLoading) {
return (
<div className="flex items-center justify-center py-8">
<Loader2 className="w-4 h-4 animate-spin text-blue-600 dark:text-blue-400" />
<Loader2 className="w-4 h-4 animate-spin text-primary" />
<span className="ml-2 text-sm text-muted-foreground">{loadingLabel ?? 'Loading...'}</span>
</div>
)
@@ -71,7 +71,7 @@ export function SettingsList({
if (error) {
return (
<div className="text-center py-6 text-muted-foreground">
<AlertCircle className="w-10 h-10 mx-auto mb-3 opacity-50 text-red-500" />
<AlertCircle className="w-10 h-10 mx-auto mb-3 opacity-50 text-destructive" />
<p className="text-sm">{errorTitle ?? 'Failed to load'}</p>
<p className="text-xs mt-1">{error.message}</p>
</div>
+2 -2
View File
@@ -179,8 +179,8 @@ export function SidebarCollapseToggle({ collapsed, onToggle }: SidebarCollapseTo
<span aria-hidden="true" className="relative flex items-center justify-center">
<span
className={cn(
'h-8 w-1 rounded-full bg-orange-500/60 transition-colors duration-150',
'group-hover:bg-orange-500 group-focus-visible:bg-orange-500'
'h-8 w-1 rounded-full bg-highlight/60 transition-colors duration-150',
'group-hover:bg-highlight group-focus-visible:bg-highlight'
)}
/>
<ChevronLeft
+2 -2
View File
@@ -9,7 +9,7 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-gray-500 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-green-600 data-[state=checked]:border-green-500 data-[state=unchecked]:bg-gray-700",
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-success data-[state=checked]:border-success data-[state=unchecked]:bg-input",
className
)}
{...props}
@@ -17,7 +17,7 @@ const Switch = React.forwardRef<
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 disabled:bg-gray-400"
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 disabled:bg-muted"
)}
/>
</SwitchPrimitives.Root>
@@ -84,7 +84,7 @@ const VirtualizedLine = memo(function VirtualizedLine({
}: VirtualizedLineProps) {
return (
<div
className={`absolute flex overflow-hidden ${isHighlighted ? 'bg-yellow-500/30' : 'bg-background'}`}
className={`absolute flex overflow-hidden ${isHighlighted ? 'bg-warning/30' : 'bg-background'}`}
style={{
transform: `translate3d(0, ${top}px, 0)`,
height,
@@ -112,7 +112,7 @@ const VirtualizedLine = memo(function VirtualizedLine({
value={content}
onChange={(e) => onLineChange(lineNum, e.target.value)}
className={`flex-1 bg-transparent outline-none pl-2 text-[16px] md:text-sm ${
isEdited ? 'bg-yellow-500/10' : ''
isEdited ? 'bg-warning/10' : ''
} ${
lineWrap ? 'whitespace-pre-wrap break-all' : 'whitespace-pre'
}`}