Skip to content

Apply dark mode in many files#859

Open
awilliansd wants to merge 7 commits intopaolosalvatori:mainfrom
awilliansd:feature/dark-mode
Open

Apply dark mode in many files#859
awilliansd wants to merge 7 commits intopaolosalvatori:mainfrom
awilliansd:feature/dark-mode

Conversation

@awilliansd
Copy link
Copy Markdown

@awilliansd awilliansd commented Mar 12, 2026

Add Dark/Light Theme Toggle

Summary

Adds a runtime dark/light theme toggle to Service Bus Explorer.
Default is dark, switchable via View → Theme → Dark / Light, with persistence across sessions.

Changes

New

  • Helpers/ThemeManager.cs — theming engine (recursive apply, persistence, custom control support)
  • Helpers/MainFormThemeExtension.cs — menu injection + native dark title bar

Updated

  • MainForm.cs — initializes theming
  • All Forms and UserControls — apply theme after InitializeComponent()
  • All .Designer.cs — neutralized hardcoded colors

Technical Overview

  • Recursive theming via ThemeManager.Apply(Control)
  • Runtime switching with SetTheme / Toggle
  • Reapplies theme to all open forms
  • Preference persisted via ConfigurationManager
  • Custom control support via reflection
  • Dark rendering for ToolStrip, MenuStrip, TabControl
  • Native dark title bar (Windows 10 1903+ via DWM)

Themes

Dark

  • Background: #212121
  • Surface: #2A2A2A
  • Border: #484848
  • Text: #ECECEC
  • Accent: #007ACC

Light

  • Uses SystemColors (native Windows appearance)

Notes

  • UI-only change (no impact on logic)
  • AboutForm excluded due to custom background
  • Azure logo uses fixed background for visibility

Testing

  • Verified on Windows 11 (.NET Framework 4.7.2)
  • All forms render correctly in both themes
  • Theme persists after restart

Copy link
Copy Markdown
Collaborator

@SeanFeldman SeanFeldman left a comment

Choose a reason for hiding this comment

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

@awilliansd there are a few comments that apply to multiple places.
Also, the screenshots are missing.
The AI-generated documentation has the "Build script" section, mentioning a build script build-dark-theme.ps1, but that's not in the PR. Nor should there be, as it should work with the existing build infrastructure.

Comment on lines +1 to +9
// ThemeManager.cs
// Caminho: src/ServiceBusExplorer/Helpers/ThemeManager.cs
//
// Gerencia tema Dark/Light com persistência no app.config do usuário.
// Uso:
// ThemeManager.Apply(form) — aplica o tema atual ao form
// ThemeManager.Toggle(form) — alterna dark/light e reaaplica
// ThemeManager.IsDark — true se tema escuro ativo
// ThemeManager.CurrentTheme — "Dark" ou "Light"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comments should be in English and applied to the class using XML doc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've reformulated the comments. Sorry for the mistake. Thanks for the feedback.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still not English.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There are no comments in portuguese anymore. This is a old commit.


public static class ThemeManager
{
// ── Chave no app.config ───────────────────────────────────────────────
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please re-work the AI comments to adhere to the comment above. Thank you.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've reformulated the comments. Sorry for the mistake. Thanks for the feedback.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The comments still appear to be in Portuguese.
Also, the standard comments in the repo are in the following format.

// Comment

Copy link
Copy Markdown
Author

@awilliansd awilliansd Mar 18, 2026

Choose a reason for hiding this comment

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

There are no comments in portuguese anymore. This is a old commit.

@awilliansd
Copy link
Copy Markdown
Author

I've fixed the comments, added the script I used, and refactored several times. I've also added screenshots in the folder. Sorry for my mistake. Thanks for the feedback.

@awilliansd awilliansd requested a review from SeanFeldman March 16, 2026 00:34
@@ -0,0 +1,449 @@
# build-dark-theme.ps1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of this script after this PR is merged?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I put the script just for understanding and the work that was done and tested, I removed the script, left the PR clean and fixed the PR documentation.

@awilliansd awilliansd requested a review from SeanFeldman March 18, 2026 11:27
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