Skip to content

fix(desktop): restore COLORFGBG env var and mosaic theme for light mode#1235

Merged
Kitenite merged 10 commits intomainfrom
kitenite/fix-opencode-theme-light-mode-displaying
Feb 13, 2026
Merged

fix(desktop): restore COLORFGBG env var and mosaic theme for light mode#1235
Kitenite merged 10 commits intomainfrom
kitenite/fix-opencode-theme-light-mode-displaying

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 5, 2026

Summary

  • Restore COLORFGBG environment variable for TUI light mode detection (lost during terminal hooks refactor)
  • Fix Mosaic pane layout hardcoded dark theme class to dynamically switch based on active theme

What was broken

TUI applications like OpenCode and Claude Code use the COLORFGBG env var to detect whether the terminal has a light or dark background. This was previously added in commit da897cfa5 but was lost when the terminal component was refactored into separate hooks. Without it, these apps render with dark-mode colors on a light background, making text unreadable.

Additionally, the Mosaic pane container always used mosaic-theme-dark class regardless of the active theme.

Changes

  • Thread themeType from renderer → tRPC → buildTerminalEnv → PTY environment
  • Set COLORFGBG to "0;15" (light) or "15;0" (dark) based on active theme
  • Update Mosaic class to dynamically use mosaic-theme-light or mosaic-theme-dark
  • Update CSS selectors to apply to both theme classes using :is()
  • Add tests for COLORFGBG behavior

Test plan

  • Switch to light theme and open a new terminal — verify TUI apps (OpenCode, Claude Code) render with light-mode colors
  • Switch back to dark theme and open a new terminal — verify dark mode still works
  • Verify Mosaic pane borders/toolbars look correct in both light and dark mode
  • Run bun test apps/desktop/src/main/lib/terminal/env.test.ts — all 70 tests pass

Summary by CodeRabbit

  • New Features
    • Terminal and session creation now respect light/dark selection and apply appropriate colors automatically.
    • Tabs adapt their theme class so tab styling matches light or dark mode.
  • Behavior
    • Theme choice is forwarded to terminal sessions so environment color variables reflect the current theme.
    • Create/attach flows automatically apply a resolved theme when none is provided.
  • Tests
    • Added unit tests covering theme resolution and terminal environment color behavior.

The COLORFGBG environment variable (used by TUI apps like OpenCode and
Claude Code to detect light/dark terminal backgrounds) was lost during
the terminal hooks refactor. This restores it by passing themeType from
the renderer through tRPC to buildTerminalEnv.

Also fixes the Mosaic pane layout which had a hardcoded dark theme class
by dynamically switching between mosaic-theme-dark and mosaic-theme-light.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Threads an optional themeType ("dark" | "light") end-to-end through renderer hooks, theme utils, TRPC router, daemon/session/env builders, and UI styling; resolves final theme from requested value, persisted state, or system preference and injects COLORFGBG for light/dark detection. Also adds tests and removes a deprecated terminal stream test file.

Changes

Cohort / File(s) Summary
TRPC router & theme resolution
apps/desktop/src/lib/trpc/routers/terminal/terminal.ts, apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts, apps/desktop/src/lib/trpc/routers/terminal/theme-type.test.ts
Adds optional themeType to createOrAttach input, uses resolveTerminalThemeType in the router, and adds unit tests for theme resolution logic.
Daemon / session / env
apps/desktop/src/main/lib/terminal/daemon/daemon-manager.ts, apps/desktop/src/main/lib/terminal/session.ts, apps/desktop/src/main/lib/terminal/env.ts, apps/desktop/src/main/lib/terminal/env.test.ts, apps/desktop/src/main/lib/terminal/types.ts
Threads themeType through CreateSessionParams → daemon manager → buildTerminalEnv; computes/injects COLORFGBG ("0;15" for light, "15;0" for dark) and adds tests.
Renderer types & consumers
apps/desktop/src/renderer/screens/main/.../Terminal/types.ts, apps/desktop/src/renderer/react-query/workspaces/useOpenWorktree.ts, apps/desktop/src/renderer/react-query/workspaces/useOpenExternalWorktree.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceInitEffects.tsx, apps/desktop/src/renderer/screens/main/.../Terminal/hooks/useTerminalConnection.ts
Adds themeType to CreateOrAttachInput and replaces direct tRPC mutation usage with useCreateOrAttachWithTheme() in multiple consumers so theme is applied automatically.
Renderer hook & theme utils
apps/desktop/src/renderer/hooks/useCreateOrAttachWithTheme.ts, apps/desktop/src/renderer/stores/theme/utils/terminal-theme-type.ts, apps/desktop/src/renderer/stores/theme/utils/terminal-theme-type.test.ts, apps/desktop/src/renderer/stores/theme/utils/index.ts
Adds useCreateOrAttachWithTheme to inject resolved themeType into mutation inputs; introduces renderer-side resolveTerminalThemeType (localStorage fallback) with tests and re-exports the util.
UI components & styling
apps/desktop/src/renderer/screens/main/.../TabView/index.tsx, apps/desktop/src/renderer/screens/main/.../TabView/mosaic-theme.css
Makes TabView theme class dynamic via useTheme and refactors CSS selectors to use :is() to unify rules across theme classes.
Tests removed
apps/desktop/src/lib/trpc/routers/terminal/terminal.stream.test.ts
Deletes an existing terminal stream test file (entire file removed).

Sequence Diagram

sequenceDiagram
    participant UI as UI Component
    participant Hook as useCreateOrAttachWithTheme
    participant Store as Theme Store / utils
    participant Router as TRPC Router
    participant Daemon as Daemon Manager
    participant Env as buildTerminalEnv
    participant Session as Terminal Session

    UI->>Hook: mutate(params)
    Hook->>Store: resolveTerminalThemeType(activeTheme)
    Store-->>Hook: themeType
    Hook->>Router: terminal.createOrAttach(params + themeType)
    Router->>Router: resolveTerminalThemeType(requested, persisted, systemPref)
    Router-->>Daemon: doCreateOrAttach(params + resolvedThemeType)
    Daemon->>Env: buildTerminalEnv(params + themeType)
    Env->>Env: compute COLORFGBG from themeType
    Env-->>Daemon: env (includes COLORFGBG)
    Daemon->>Session: createSession(params + env)
    Session-->>Daemon: session created
    Daemon-->>Router: response
    Router-->>Hook: success
    Hook-->>UI: mutation complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰
I nibble code in morning light,
Dark or bright, the terminal's right,
COLORFGBG stamped with care,
Sessions bloom with themed fanfare,
Hooray — hopping through lines, delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (22 files):

⚔️ apps/desktop/src/lib/trpc/routers/terminal/terminal.ts (content)
⚔️ apps/desktop/src/main/lib/terminal/daemon/daemon-manager.ts (content)
⚔️ apps/desktop/src/main/lib/terminal/env.test.ts (content)
⚔️ apps/desktop/src/main/lib/terminal/env.ts (content)
⚔️ apps/desktop/src/main/lib/terminal/session.ts (content)
⚔️ apps/desktop/src/main/lib/terminal/types.ts (content)
⚔️ apps/desktop/src/renderer/react-query/workspaces/useOpenExternalWorktree.ts (content)
⚔️ apps/desktop/src/renderer/react-query/workspaces/useOpenWorktree.ts (content)
⚔️ apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/PropertiesSidebar.tsx (content)
⚔️ apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/AssigneeCell/AssigneeCell.tsx (content)
⚔️ apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/PriorityCell/PriorityCell.tsx (content)
⚔️ apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/StatusCell/StatusCell.tsx (content)
⚔️ apps/desktop/src/renderer/screens/main/components/WorkspaceInitEffects.tsx (content)
⚔️ apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/index.tsx (content)
⚔️ apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/mosaic-theme.css (content)
⚔️ apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalConnection.ts (content)
⚔️ apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/types.ts (content)
⚔️ apps/desktop/src/renderer/stores/theme/utils/index.ts (content)
⚔️ bun.lock (content)
⚔️ packages/mcp/package.json (content)
⚔️ packages/mcp/src/tools/devices/start-claude-session/start-claude-session.ts (content)
⚔️ packages/shared/package.json (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main changes: restoring COLORFGBG environment variable and fixing Mosaic theme to support light mode, matching the primary objectives of the PR.
Description check ✅ Passed The PR description is comprehensive and addresses the template requirements: it provides a clear summary, explains what was broken and why, details all changes, and includes a concrete test plan with specific verification steps.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/fix-opencode-theme-light-mode-displaying
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch kitenite/fix-opencode-theme-light-mode-displaying
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalColdRestore.ts (2)

154-171: ⚠️ Potential issue | 🟡 Minor

Remove themeTypeRef.current from dependency array.

Adding ref.current to a dependency array is incorrect. Refs are stable objects that don't trigger re-renders when their .current value changes. The callback already reads themeTypeRef.current at invocation time, which is the correct pattern.

Including .current in the deps array will:

  1. Capture a stale value at callback creation time
  2. Not trigger re-creation when the theme actually changes (since ref mutations don't cause re-renders)
Proposed fix
 	}, [
 		paneId,
 		tabId,
 		workspaceId,
 		xtermRef,
 		isStreamReadyRef,
 		isExitedRef,
 		wasKilledByUserRef,
 		isFocusedRef,
 		didFirstRenderRef,
 		pendingInitialStateRef,
 		createOrAttachRef,
 		setConnectionError,
 		setExitStatus,
 		maybeApplyInitialState,
 		flushPendingEvents,
-		themeTypeRef.current,
 	]);

238-256: ⚠️ Potential issue | 🟡 Minor

Same issue: remove themeTypeRef.current from dependency array.

Same concern as handleRetryConnection — ref values should not be in dependency arrays.

Proposed fix
 	}, [
 		paneId,
 		tabId,
 		workspaceId,
 		xtermRef,
 		fitAddonRef,
 		isStreamReadyRef,
 		isExitedRef,
 		wasKilledByUserRef,
 		pendingInitialStateRef,
 		pendingEventsRef,
 		createOrAttachRef,
 		setConnectionError,
 		setExitStatus,
 		maybeApplyInitialState,
 		flushPendingEvents,
 		resetModes,
-		themeTypeRef.current,
 	]);
🧹 Nitpick comments (1)
apps/desktop/src/main/lib/terminal/env.ts (1)

326-370: Extract COLORFGBG values to named constants.

Keeps the ANSI codes discoverable and prevents accidental drift if reused elsewhere.

♻️ Suggested refactor
 export const FALLBACK_SHELL = os.platform() === "win32" ? "cmd.exe" : "/bin/sh";
 export const SHELL_CRASH_THRESHOLD_MS = 1000;
+const COLORFGBG_LIGHT = "0;15";
+const COLORFGBG_DARK = "15;0";
@@
-	const colorFgBg = themeType === "light" ? "0;15" : "15;0";
+	const colorFgBg = themeType === "light" ? COLORFGBG_LIGHT : COLORFGBG_DARK;

As per coding guidelines, extract hardcoded magic numbers, strings, and enums to named constants at module top instead of leaving them inline in logic.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalColdRestore.ts (1)

154-171: ⚠️ Potential issue | 🟡 Minor

themeTypeRef.current in dependency arrays should be themeTypeRef.

All other refs in these dependency arrays are listed as ref objects (e.g., xtermRef, createOrAttachRef), not .current. Using .current is inconsistent and technically incorrect — React cannot track mutations to a ref's .current property, so it won't reliably trigger callback recreation. Since you're already reading themeTypeRef.current inside the callback body (line 98), listing the stable ref object is sufficient and consistent with the existing pattern.

Same issue in handleStartShell at line 255.

Proposed fix
 	], [
 		paneId,
 		tabId,
 		workspaceId,
 		xtermRef,
 		isStreamReadyRef,
 		isExitedRef,
 		wasKilledByUserRef,
 		isFocusedRef,
 		didFirstRenderRef,
 		pendingInitialStateRef,
 		createOrAttachRef,
 		setConnectionError,
 		setExitStatus,
 		maybeApplyInitialState,
 		flushPendingEvents,
-		themeTypeRef.current,
+		themeTypeRef,
 	]);
 		createOrAttachRef,
 		setConnectionError,
 		setExitStatus,
 		maybeApplyInitialState,
 		flushPendingEvents,
 		resetModes,
-		themeTypeRef.current,
+		themeTypeRef,
 	]);
🤖 Fix all issues with AI agents
In `@apps/desktop/src/lib/trpc/routers/terminal/terminal.ts`:
- Around line 124-127: The fallback path calling resolveTerminalThemeType
currently omits systemPrefersDark, causing persisted "system" theme to assume
dark; update the call that computes resolvedThemeType (where themeType and
appState.data.themeState are passed) to also provide the real OS preference by
reading Electron's nativeTheme.shouldUseDarkColors from the main process (expose
it via your existing IPC/getAPI if needed) and pass that boolean as
systemPrefersDark to resolveTerminalThemeType so "system" resolves correctly.

In `@apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts`:
- Around line 27-28: Replace the hardcoded "system" sentinel with the shared
constant: import and use SYSTEM_THEME_ID in the activeThemeId check (the
comparison involving activeThemeId and the branch that returns systemPrefersDark
? "dark" : "light"). Update the import at the top of theme-type.ts to pull
SYSTEM_THEME_ID from the module that defines it (or move SYSTEM_THEME_ID to the
shared/themes module alongside DEFAULT_THEME_ID and import from there) so the
comparison uses SYSTEM_THEME_ID instead of the literal string.
🧹 Nitpick comments (3)
apps/desktop/src/renderer/react-query/workspaces/useOpenExternalWorktree.ts (1)

21-24: Consider extracting a useTerminalThemeType() hook to reduce duplication.

This exact 3-line pattern (useTheme()resolveTerminalThemeType(...)) is repeated in WorkspaceInitEffects.tsx, useOpenExternalWorktree.ts, and useOpenWorktree.ts. A small hook would centralize the logic:

export function useTerminalThemeType(): ThemeType {
  const activeTheme = useTheme();
  return resolveTerminalThemeType({ activeThemeType: activeTheme?.type });
}
apps/desktop/src/lib/trpc/routers/terminal/theme-type.test.ts (1)

14-72: Good test coverage of the key resolution paths.

The tests cover explicit requests, built-in themes, custom themes, system preference, and unknown-theme fallback. One minor gap: there's no test exercising the persistedThemeState: undefined (without requestedThemeType) path — i.e., calling resolveTerminalThemeType({}) and expecting "dark". The first test happens to omit persistedThemeState, but it short-circuits on requestedThemeType before reaching that branch. Consider adding a one-liner for completeness:

it("falls back to dark when no persisted state exists", () => {
    expect(resolveTerminalThemeType({})).toBe("dark");
});
apps/desktop/src/renderer/stores/theme/utils/terminal-theme-type.ts (1)

1-5: ThemeType is defined independently in two files.

This same type ThemeType = "dark" | "light" is also declared in apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts (line 4). Since the project already has a shared/ directory (used for themes), consider extracting ThemeType there so both the renderer and tRPC resolver import the same canonical type — avoiding silent divergence if one is updated without the other.

Comment on lines +124 to +127
const resolvedThemeType = resolveTerminalThemeType({
requestedThemeType: themeType,
persistedThemeState: appState.data.themeState,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's find and examine the terminal.ts file around the specified lines
find . -name "terminal.ts" -path "*/trpc/routers/terminal/*" | head -5

Repository: superset-sh/superset

Length of output: 120


🏁 Script executed:

# Check nativeTheme usage in the codebase
rg -n --type=ts 'nativeTheme' -g '!node_modules/**' | head -20

Repository: superset-sh/superset

Length of output: 280


🏁 Script executed:

# Look at the theme-type.ts file to understand the resolveTerminalThemeType function
find . -name "theme-type.ts" -path "*/terminal/*" | head -5

Repository: superset-sh/superset

Length of output: 122


🏁 Script executed:

# Read terminal.ts around lines 124-127 to verify the actual code
cat -n apps/desktop/src/lib/trpc/routers/terminal/terminal.ts | sed -n '115,135p'

Repository: superset-sh/superset

Length of output: 707


🏁 Script executed:

# Read theme-type.ts to check the function signature and defaults
cat -n apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts

Repository: superset-sh/superset

Length of output: 1260


🏁 Script executed:

# Also check the imports at the top of terminal.ts to verify nativeTheme availability
cat -n apps/desktop/src/lib/trpc/routers/terminal/terminal.ts | head -30

Repository: superset-sh/superset

Length of output: 1419


🏁 Script executed:

# Check the input schema to see if themeType is optional or required
cat -n apps/desktop/src/lib/trpc/routers/terminal/terminal.ts | sed -n '60,90p'

Repository: superset-sh/superset

Length of output: 1051


🏁 Script executed:

# Look for where this tRPC procedure is called from to understand if themeType is always provided
rg -n 'createOrAttach' -A 2 -B 2 --type=ts -g '!node_modules/**' | head -40

Repository: superset-sh/superset

Length of output: 2887


🏁 Script executed:

# Search for where the tRPC terminal.createOrAttach is called from the renderer side
rg -n 'terminal\.createOrAttach' --type=ts -g '!node_modules/**' -A 5 -B 5

Repository: superset-sh/superset

Length of output: 7746


🏁 Script executed:

# Check if there's a renderer-side theme resolution that determines themeType
rg -n 'resolveTerminalThemeType' --type=ts -g '!node_modules/**' -B 3 -A 3

Repository: superset-sh/superset

Length of output: 19732


systemPrefersDark is not passed to resolveTerminalThemeType — "system" theme in the fallback path will always default to dark.

When the renderer doesn't send themeType and the persisted theme is "system", the function defaults systemPrefersDark to true, resolving to "dark". While the normal path sends themeType from the renderer, the fallback (cold restore or missing themeType) needs to detect the actual OS preference. Use Electron's nativeTheme.shouldUseDarkColors in the main process:

Suggested fix
+import { nativeTheme } from "electron";
 ...
 const resolvedThemeType = resolveTerminalThemeType({
 	requestedThemeType: themeType,
 	persistedThemeState: appState.data.themeState,
+	systemPrefersDark: nativeTheme.shouldUseDarkColors,
 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const resolvedThemeType = resolveTerminalThemeType({
requestedThemeType: themeType,
persistedThemeState: appState.data.themeState,
});
import { nativeTheme } from "electron";
// ... other imports ...
import { appState } from "main/lib/app-state";
import { resolveTerminalThemeType } from "./theme-type";
// ... rest of file ...
const resolvedThemeType = resolveTerminalThemeType({
requestedThemeType: themeType,
persistedThemeState: appState.data.themeState,
systemPrefersDark: nativeTheme.shouldUseDarkColors,
});
🤖 Prompt for AI Agents
In `@apps/desktop/src/lib/trpc/routers/terminal/terminal.ts` around lines 124 -
127, The fallback path calling resolveTerminalThemeType currently omits
systemPrefersDark, causing persisted "system" theme to assume dark; update the
call that computes resolvedThemeType (where themeType and
appState.data.themeState are passed) to also provide the real OS preference by
reading Electron's nativeTheme.shouldUseDarkColors from the main process (expose
it via your existing IPC/getAPI if needed) and pass that boolean as
systemPrefersDark to resolveTerminalThemeType so "system" resolves correctly.

Comment on lines +27 to +28
if (activeThemeId === "system") {
return systemPrefersDark ? "dark" : "light";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how widely the "system" activeThemeId sentinel is referenced
rg -n --type=ts '"system"' -g '!node_modules/**' -g '*theme*'

Repository: superset-sh/superset

Length of output: 430


🏁 Script executed:

#!/bin/bash
# Search for existing theme constants or enums
rg -n --type=ts '(THEME|theme).*=.*["\']system["\']' -g '!node_modules/**'

# Also check for type definitions or constants in the theme file itself
echo "=== Checking theme-type.ts file structure ==="
head -50 apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts

Repository: superset-sh/superset

Length of output: 132


🏁 Script executed:

#!/bin/bash
# Search for existing theme constants
rg -n --type=ts 'THEME' -g '!node_modules/**' apps/desktop/src/lib/trpc/routers/terminal/

# Check for type definitions and constants in the theme file
echo "=== Checking theme-type.ts file structure ==="
head -60 apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts

Repository: superset-sh/superset

Length of output: 1295


🏁 Script executed:

#!/bin/bash
# Check the shared/themes module to see the pattern of theme constants
cat apps/desktop/src/shared/themes/index.ts || find . -path '*shared/themes*' -name '*.ts' -type f | head -5

Repository: superset-sh/superset

Length of output: 452


🏁 Script executed:

#!/bin/bash
# Check the built-in.ts file to see all theme constants
cat apps/desktop/src/shared/themes/built-in.ts | head -100

Repository: superset-sh/superset

Length of output: 138


🏁 Script executed:

#!/bin/bash
# Find the actual themes module
find . -path '*shared/themes*' -type f -name '*.ts' | grep -v node_modules

echo "=== Directory structure ==="
find . -path '*shared/themes*' -type d | grep -v node_modules

Repository: superset-sh/superset

Length of output: 649


🏁 Script executed:

#!/bin/bash
# Check the built-in/index.ts to see theme constants
cat apps/desktop/src/shared/themes/built-in/index.ts

echo ""
echo "=== Check if SYSTEM_THEME_ID exists anywhere ==="
rg -n 'SYSTEM_THEME_ID' -g '!node_modules/**'

Repository: superset-sh/superset

Length of output: 1785


🏁 Script executed:

#!/bin/bash
# Check the context around SYSTEM_THEME_ID definition in store.ts
sed -n '15,30p' apps/desktop/src/renderer/stores/theme/store.ts

echo ""
echo "=== Check if theme-type.ts imports SYSTEM_THEME_ID ==="
grep -n 'SYSTEM_THEME_ID' apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts

Repository: superset-sh/superset

Length of output: 583


🏁 Script executed:

#!/bin/bash
# Check if lib/trpc code typically imports from renderer stores
rg -n 'from.*renderer' apps/desktop/src/lib/trpc/ -g '!node_modules/**'

echo ""
echo "=== Check what shared/themes exports ==="
cat apps/desktop/src/shared/themes/types.ts | head -50

Repository: superset-sh/superset

Length of output: 1273


🏁 Script executed:

#!/bin/bash
# Check what SYSTEM_THEME_ID depends on (what does store.ts import)
sed -n '1,25p' apps/desktop/src/renderer/stores/theme/store.ts

echo ""
echo "=== Check theme-type.ts full imports ==="
head -10 apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts

Repository: superset-sh/superset

Length of output: 1099


🏁 Script executed:

#!/bin/bash
# Check the ThemeState definition to understand the schema
grep -A 10 'interface ThemeState' apps/desktop/src/main/lib/app-state/schemas.ts || \
grep -A 10 'type ThemeState' apps/desktop/src/main/lib/app-state/schemas.ts

Repository: superset-sh/superset

Length of output: 256


Use the existing SYSTEM_THEME_ID constant instead of the hardcoded "system" string.

The sentinel value "system" is already defined as SYSTEM_THEME_ID in apps/desktop/src/renderer/stores/theme/store.ts and is used throughout the renderer code. Import and use this constant in theme-type.ts at line 27 to maintain consistency and prevent typo-related bugs. If SYSTEM_THEME_ID should be shared across the main and renderer processes, consider moving it to shared/themes alongside DEFAULT_THEME_ID.

🤖 Prompt for AI Agents
In `@apps/desktop/src/lib/trpc/routers/terminal/theme-type.ts` around lines 27 -
28, Replace the hardcoded "system" sentinel with the shared constant: import and
use SYSTEM_THEME_ID in the activeThemeId check (the comparison involving
activeThemeId and the branch that returns systemPrefersDark ? "dark" : "light").
Update the import at the top of theme-type.ts to pull SYSTEM_THEME_ID from the
module that defines it (or move SYSTEM_THEME_ID to the shared/themes module
alongside DEFAULT_THEME_ID and import from there) so the comparison uses
SYSTEM_THEME_ID instead of the literal string.

@Kitenite Kitenite merged commit 30af58b into main Feb 13, 2026
6 checks passed
@Kitenite Kitenite deleted the kitenite/fix-opencode-theme-light-mode-displaying branch February 13, 2026 22:52
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app
  • ⚠️ Streams Fly.io app

Thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant