Skip to content

feat(desktop): allow custom theme mapping for System theme mode#2548

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-2547-23209223004
Closed

feat(desktop): allow custom theme mapping for System theme mode#2548
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-2547-23209223004

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Mar 17, 2026

Summary

  • Adds systemLightThemeId and systemDarkThemeId fields to the theme store, allowing users to configure which installed theme to use for each OS mode when "System" is selected
  • Updates resolveThemeId to use these custom mappings instead of hardcoded "dark"/"light" built-in IDs
  • Enhances SystemThemeCard to show two dropdown selectors (filtered by theme type) when System is the active theme, letting users pick any matching-type theme for dark and light OS modes
  • Resets system mapping to built-in defaults when a mapped custom theme is removed
  • Backwards-compatible: defaults match current behavior ("dark" for dark mode, "light" for light mode)

Test plan

  • Unit tests for store logic (store.test.ts) — 7 tests covering default mappings, resolution for dark/light OS modes, custom mapping, re-apply on mapping change, no-op when system not active, and reset on custom theme removal
  • Manual: select System theme, verify dark/light dropdowns appear
  • Manual: change dark mapping to Monokai, toggle OS dark mode — verify Monokai is applied
  • Manual: import a custom dark theme, verify it appears in the dark dropdown
  • Manual: remove a custom theme used as a system mapping, verify it resets to built-in

Closes #2547


Summary by cubic

Adds custom mapping for System theme mode so users can choose which theme applies in dark and light OS modes. Implements #2547; defaults to built-in dark/light and resets mappings if a chosen theme is removed.

  • New Features
    • Added systemLightThemeId and systemDarkThemeId to the theme store and updated resolution logic to honor them.
    • Updated SystemThemeCard to show dark/light dropdowns (filtered by type) when System is selected, and re-apply instantly if System is active.
    • Persisted mappings and handled removal by falling back to built-in themes.

Written for commit a0725cc. Summary will update on new commits.

Add systemLightThemeId and systemDarkThemeId fields to the theme store,
letting users configure which theme to use for each OS mode when "System"
is selected. The SystemThemeCard now shows dropdown selectors (filtered
by theme type) when active. Defaults match current behavior (dark/light).

Refs #2547
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/stores/theme/store.ts">

<violation number="1" location="apps/desktop/src/renderer/stores/theme/store.ts:262">
P2: After removing a custom theme used by system mapping, the store resets mapping IDs but does not re-apply the active system theme. This can leave `activeTheme`/UI state on a deleted theme until a later theme change occurs.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment on lines +262 to +267
if (state.systemDarkThemeId === themeId) {
set({ systemDarkThemeId: "dark" });
}
if (state.systemLightThemeId === themeId) {
set({ systemLightThemeId: "light" });
}
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 17, 2026

Choose a reason for hiding this comment

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

P2: After removing a custom theme used by system mapping, the store resets mapping IDs but does not re-apply the active system theme. This can leave activeTheme/UI state on a deleted theme until a later theme change occurs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/stores/theme/store.ts, line 262:

<comment>After removing a custom theme used by system mapping, the store resets mapping IDs but does not re-apply the active system theme. This can leave `activeTheme`/UI state on a deleted theme until a later theme change occurs.</comment>

<file context>
@@ -210,6 +258,14 @@ export const useThemeStore = create<ThemeState>()(
 					}
 
+					// If removing a theme used in system mapping, reset to built-in
+					if (state.systemDarkThemeId === themeId) {
+						set({ systemDarkThemeId: "dark" });
+					}
</file context>
Suggested change
if (state.systemDarkThemeId === themeId) {
set({ systemDarkThemeId: "dark" });
}
if (state.systemLightThemeId === themeId) {
set({ systemLightThemeId: "light" });
}
const removedMappedSystemTheme =
state.systemDarkThemeId === themeId ||
state.systemLightThemeId === themeId;
if (state.systemDarkThemeId === themeId) {
set({ systemDarkThemeId: "dark" });
}
if (state.systemLightThemeId === themeId) {
set({ systemLightThemeId: "light" });
}
if (removedMappedSystemTheme && state.activeThemeId === SYSTEM_THEME_ID) {
state.setTheme(SYSTEM_THEME_ID);
}
Fix with Cubic

@Kitenite
Copy link
Copy Markdown
Collaborator

Kitenite commented May 6, 2026

Closing as stale: bot PR created 6+ weeks ago with no iteration since. Re-attempt from a fresh branch if a fix is still wanted. Bulk audit 2026-05-06.

@Kitenite Kitenite closed this May 6, 2026
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.

[feat] Allow custom theme mapping for System theme mode

1 participant