Skip to content

🤖 feat: add auto theme preference that follows system theme#2460

Open
jaaydenh wants to merge 4 commits intomainfrom
feat/auto-theme-system-default
Open

🤖 feat: add auto theme preference that follows system theme#2460
jaaydenh wants to merge 4 commits intomainfrom
feat/auto-theme-system-default

Conversation

@jaaydenh
Copy link
Contributor

@jaaydenh jaaydenh commented Feb 17, 2026

Summary

Add an Auto theme preference that follows the operating system light/dark setting and make Auto the default for users with no saved theme preference.

Background

Today the app only persisted concrete themes (light, dark, flexoki-light, flexoki-dark) and resolved system theme only at startup. That meant users did not have an explicit “follow system” choice and the UI did not continue tracking OS theme changes while running.

Implementation

  • Added a persisted ThemePreference model with auto plus existing manual themes.
  • Kept theme exposed as a resolved concrete theme for existing consumers to avoid broad downstream breakage.
  • Added live OS-theme following in ThemeContext using matchMedia('(prefers-color-scheme: light)') change listeners when preference is auto.
  • Fixed manual → auto transitions to resolve from the current matchMedia value immediately, preventing a transient stale-theme flash.
  • Updated pre-hydration bootstrap in index.html to parse/normalize auto and resolve to concrete light/dark before first paint.
  • Added Auto to theme selection surfaces (settings + selector + command palette).
  • Kept theme cycle behavior manual-only; Auto is an explicit selection.
  • Extended tests for auto defaulting, normalization, live-follow behavior, manual override behavior, and command palette visibility.

Validation

  • bun test src/browser/contexts/ThemeContext.test.tsx
  • bun test src/browser/utils/commands/sources.test.ts
  • make lint
  • make typecheck
  • make fmt-check
  • make static-check

Risks

  • This change is renderer-first and does not yet bridge Electron nativeTheme state to renderer via IPC.
  • Windows has nuanced app-vs-system integrated UI theme semantics; Auto currently follows renderer prefers-color-scheme behavior.
  • Linux system theme signal quality can vary by desktop environment; manual override remains available.

Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $0.00

- Persist theme preference separately from resolved concrete theme so existing consumers keep receiving concrete values.
- Add auto follow behavior in the renderer via prefers-color-scheme change listeners.
- Expose Auto in settings, compact selector, command palette, and pre-hydration theme bootstrap; keep cycle/toggle manual-only.
- Expand ThemeContext and command source tests for auto preference behavior.
@jaaydenh
Copy link
Contributor Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 608080d738

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh
Copy link
Contributor Author

@codex review

Please take another look.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh jaaydenh self-assigned this Feb 18, 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.

1 participant

Comments