Skip to content

Dark mode by default with light mode toggle - #3

Merged
aaditkedia merged 1 commit into
mainfrom
dark-mode-default
Jul 19, 2026
Merged

Dark mode by default with light mode toggle#3
aaditkedia merged 1 commit into
mainfrom
dark-mode-default

Conversation

@aaditkedia

Copy link
Copy Markdown
Owner

Summary

codeviewer now starts in a VS Code Dark+-style dark theme. View > Light Mode toggles the previous light look live — every open editor, the folder tree, tabs, menus, status bar, docker panel, and markdown preview restyle in place. The choice persists across runs in %APPDATA%\codeviewer\settings.txt (missing/corrupt file falls back to dark).

Changes

  • Theme.cs (new) — named colors for every UI surface with Theme.Dark / Theme.Light instances, settings persistence, and a ProfessionalColorTable/ToolStripProfessionalRenderer pair that themes the menu bar, context menus, and status strip.
  • Languages.cs — syntax colors are now semantic tokens (comment, keyword, type, string, number, ...) resolved against a per-theme palette. Dark uses VS Code Dark+ token colors (#6A9955 comments, #569CD6 keywords, #4EC9B0 types, #CE9178 strings, ...); light resolves to exactly the previous hardcoded colors, so light mode looks identical to v1.0.0.
  • MainForm.cs — theme plumbing: ApplyTheme() restyles everything live; Scintilla editors are fully re-styled in the correct order (default style → StyleClearAll → margins/caret/selection → lexer colors); tabs are owner-drawn, and a small ThemedTabControl subclass paints the native tab strip/pane border that ignores BackColor; VS Code-style blue (#007ACC) status bar in both themes; native dark titlebar (DwmSetWindowAttribute) and dark scrollbars (SetWindowTheme), best-effort with silent fallback on older Windows.
  • DockerPanel.cs — participates in theming (lists, headers, toolbar, flat-style button in dark).
  • Markdown live preview follows the theme with a matching dark stylesheet; Compile Markdown (F7) still always emits the light stylesheet since that output is a standalone document for sharing.
  • Version bumped to 1.1.0; README documents the toggle and settings location.

Testing

  • dotnet build -c Release: 0 warnings, 0 errors.
  • Runtime-verified by launching the built exe and pixel-sampling window captures: dark default (editor #1E1E1E, tab strip #252526, status #007ACC), light theme via settings file, settings cleanup restores dark default.
  • Reviewer pass found one issue (unthemed splitter bars) — fixed and re-verified.

🤖 Generated with Claude Code

- New Theme class: dark (VS Code Dark+ palette) and light (previous
  look) themes for every surface, persisted to
  %APPDATA%\codeviewer\settings.txt; dark is the default
- Languages.cs: semantic syntax tokens with per-theme palettes; light
  output identical to the old hardcoded colors
- Live toggle via View > Light Mode: retints all open editors, tree,
  owner-drawn tabs, menus/context menus, docker panel, and the
  markdown preview without reopening anything
- VS Code-style blue status bar in both themes
- Native chrome: dark titlebar (DwmSetWindowAttribute) and dark
  scrollbars (SetWindowTheme), best-effort and crash-safe
- ThemedTabControl paints the native tab strip/pane border that
  ignores BackColor
- Compile Markdown (F7) still always emits the light stylesheet for
  standalone HTML output
- Bump version to 1.1.0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 19, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aaditkedia aaditkedia mentioned this pull request Jul 19, 2026
@aaditkedia
aaditkedia merged commit d7db2a7 into main Jul 19, 2026
2 checks passed
@aaditkedia
aaditkedia deleted the dark-mode-default branch July 19, 2026 21:39
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.

2 participants