Skip to content

Follow the SSMS colour theme in the tool window - #11

Open
mourier wants to merge 2 commits into
mainfrom
feature/follow-ssms-theme
Open

mourier wants to merge 2 commits into
mainfrom
feature/follow-ssms-theme

Conversation

@mourier

@mourier mourier commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Closes #9 (the theme half; the multi-server half is #10).

Why the pane ignored the theme

  • SearchControl.xaml asks for brush keys (ResultsBackground, PrimaryForeground, SecondaryForeground, IconForeground, …) that only DarkTheme.xaml defines, and only the demo app merges that dictionary. Inside SSMS nothing supplied them.
  • SqlPilotToolWindowControl.xaml used Windows SystemColors, plus #0078D4/White on the update bar; SearchControl.xaml had fixed Gray and Gold.
  • The search box's local Style kept any host styling from reaching it.

Change

  • Integration/SsmsThemeAdapter.cs (Package, linked into Legacy): fills the brush keys on the hosted control from VSColorTheme.GetThemedColor and refills them on VSColorTheme.ThemeChanged. SqlPilotToolWindow creates it before the control is shown and disposes it. Falls back to the matching Windows system colour for a key the shell can't resolve. Adopts the shell's scroll bar style when it publishes one.
  • Tool window XAML: no SystemColors, no fixed colours. Small themed templates for buttons and the context menu, because the stock ones hard-code light hover colours and a light icon gutter.
  • SearchControl: search box colours set as plain properties; placeholder is now an overlay TextBlock (themeable) instead of a VisualBrush; favourite star uses a key.
  • ScopeControl: tree items take the host's text colour.
  • DarkTheme.xaml / LightTheme.xaml: the new keys the shared controls use. Demo app and installer untouched. No theme setting.
  • Docs: Theming section in ARCHITECTURE.md, "Following the SSMS theme" in the integration notes. README already claims theme awareness, so it is unchanged.

Verified

Deployed to real SSMS and driven through UI Automation:

Result
SSMS 22 — Light, Dark, Moonlight Glow, Cool Breeze pane background, text, search box, buttons follow each theme
SSMS 22 — switching theme with the pane open repaints immediately, no restart
SSMS 22 Dark — results selection, Scope tree and checkboxes, context menu readable and dark
SSMS 20, SSMS 18 (Legacy build, default Blue theme) theme keys resolve; pane is light as before, context menu now matches SSMS's own menus

Also: full solution builds, 83 core + 5 installer tests pass, demo app renders correctly with DarkTheme.xaml.

Visible change on SSMS 18/20: buttons are flat themed ones instead of stock Windows buttons, and the context menu takes the shell's menu colour.

Not exercised in SSMS: the update notification bar (no update was pending) and a list long enough to show the scroll bar. The bar was checked in a standalone WPF host with dark and light palettes.

Closes #9. The XAML asked for brush keys (ResultsBackground, PrimaryForeground, ...) that only the demo app's DarkTheme.xaml ever defined, and the tool window used Windows SystemColors plus fixed colours, so inside SSMS the pane stayed light whatever the theme. SsmsThemeAdapter (Package, C#) now fills those keys on the hosted control from VSColorTheme and refills them on ThemeChanged; the tool window creates it before showing the control and disposes it. C# rather than XAML keeps VSSDK out of SqlPilot.UI and avoids naming a Shell assembly that differs between the 15.x and 17.x builds. SystemColors and fixed colours are gone from the tool window and SearchControl; the search box sets its colours directly (its local Style blocked the host's), the placeholder is an overlay so it can be themed, and buttons and the context menu get small templates because the stock ones hard-code light hover colours and a light icon gutter. No theme setting. Checked in the demo app and a XAML harness with dark and light palettes; not yet run inside SSMS.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4dbbe1e1-2c4b-4332-9d4d-cf6b4126e7af
Commits

Reviewing files that changed from the base of the PR and between 63001fd and 3d785a9.

Files selected for processing: 10

  • docs/ARCHITECTURE.md
  • docs/SSMS_INTEGRATION_NOTES.md
  • src/SqlPilot.Package.Legacy/SqlPilot.Package.Legacy.csproj
  • src/SqlPilot.Package/Integration/SsmsThemeAdapter.cs
  • src/SqlPilot.Package/SqlPilotToolWindow.cs
  • src/SqlPilot.Package/SqlPilotToolWindowControl.xaml
  • src/SqlPilot.UI/Controls/ScopeControl.xaml
  • src/SqlPilot.UI/Controls/SearchControl.xaml
  • src/SqlPilot.UI/Themes/DarkTheme.xaml
  • src/SqlPilot.UI/Themes/LightTheme.xaml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Theme keys resolve in SSMS 18/20 as well as 22; what a tool window does not get for free; where SSMS 22 keeps its themes.
@mourier
mourier marked this pull request as ready for review November 19, 2026 00:31
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.

Multiple servers and dark theme

1 participant