Skip to content

fix(editor): follow app theme in Monaco editor panes#171

Open
mvanhorn wants to merge 1 commit intodanshapiro:mainfrom
mvanhorn:osc/144-editor-pane-theme-dark-light
Open

fix(editor): follow app theme in Monaco editor panes#171
mvanhorn wants to merge 1 commit intodanshapiro:mainfrom
mvanhorn:osc/144-editor-pane-theme-dark-light

Conversation

@mvanhorn
Copy link

Summary

  • Monaco editor panes were hardcoded to vs-dark theme regardless of the app's light/dark mode setting
  • Now reads the theme from Redux settings store and resolves to vs-dark or vs (light) accordingly
  • Uses the same theme resolution logic as useThemeEffect (respects dark/light/system settings)

Fixes #144

Changes

  • src/components/panes/EditorPane.tsx: Added useMonacoTheme() hook that reads the settings theme and returns the correct Monaco theme string
  • test/unit/client/components/panes/EditorPane.test.tsx: Added tests verifying dark and light theme rendering, updated Monaco mock to capture theme prop

Test plan

  • npm run typecheck passes
  • All 20 EditorPane tests pass (including 2 new theme tests)
  • Manual: Toggle app between light and dark mode, verify editor pane follows

This contribution was developed with AI assistance (Claude Code).

The Monaco editor was hardcoded to vs-dark theme regardless of the app's
light/dark mode setting. Now reads the theme from settings and resolves
to vs-dark or vs accordingly.

Fixes danshapiro#144
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: 1ec3153e5c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +12 to +13
const isDark =
theme === 'dark' ? true : theme === 'light' ? false : getSystemPrefersDark()

Choose a reason for hiding this comment

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

P2 Badge Derive Monaco theme from resolved app theme

When settings.theme is system, this hook recomputes matchMedia on every editor render, but the app theme class is only updated when settings.theme changes (useThemeEffect depends on theme), so an OS light/dark change during a session can make Monaco switch themes while the rest of the app stays on the previous one. In practice, after a system theme flip, any editor re-render (typing, cursor movement, etc.) can cause the editor pane to stop matching the current app theme.

Useful? React with 👍 / 👎.

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.

Editor pane theme does not follow app light/dark mode

1 participant