Repository navigation
feat(ui): tune dark theme colors and make ToolStrip icons visible - #743
mfkeeq199458 wants to merge 3 commits into
Conversation
## Summary of changes ### ToolStrip dark adaptation (LogTabWindow.cs) - Add ConfigureToolStripDark(): installs a ToolStripManager global renderer with a VS Dark-derived color palette. Bypasses ToolStripContainer's TopToolStripPanel which forces RenderMode=System on every child bar. - Add DarkToolStripRenderer: OnRenderItemImage inverts dark-mode PNG glyphs via ColorMatrix so toolbar icons render as light-on-transparent against the dark bar; OnRenderItemText forces light foreground text. - Add DarkToolStripColorTable: override ProfessionalColorTable with VS2015 Dark Theme surface/highlight/accent colors. ### Hard-coded color fixes - PaintHelper.cs: soft off-white foreground (220 220 220) instead of pure #FFFFFF to reduce eye strain; centralize bookmark marker color as BookmarkMarkerTextColor property (brighter orange on dark). - LogWindow.cs: bookmark column colors get more saturation on dark. - LedIndicatorService.cs: off/neutral LEDs brightened on dark; signal colors (red/orange/yellow/green) kept theme-independent. - ColorComboBox.cs: border / text / hatch brush adapt to Application.IsDarkModeEnabled. - HighlightEntryDialog.cs: preview label foreground fallback chooses Color.White on dark instead of always falling back to Color.Black. ## Test plan - [x] Build passes with 0 errors - [x] OnRenderItemImage called and e.Image non-null at runtime - [ ] Run dark mode and verify: toolbar icons visible, colors readable, dropdowns, hover/pressed states, dialog previews ## Risk - ToolStripManager.VisualStylesEnabled = false is app-global (only set in dark mode). Other dialogs with ToolStrips not yet verified. - ColorMatrix inverts ALL RGB channels — correct for monochrome glyphs but would flip semantic colored icons if any are added later.
Hirogen
left a comment
There was a problem hiding this comment.
Review
Thanks for this, the dark toolbar is a clear improvement. The colour fixes in PaintHelper, LedIndicatorService, LogWindow and ColorComboBox only apply in dark mode, and user-configured highlight colours still win. Most of my points are about the toolbar renderer: it applies to every ToolStrip in the app, and its icon inversion has a few side effects. The "Run dark mode and verify" item in the test plan is still unchecked, and most of the problems below would show up in that check.
Toolbar renderer
Icon inversion
-
Coloured icons are already inverted today, not just "if any are added later":
- The tail button image (
toolStripButtonTail, embedded inLogTabWindow.resx) is blue and becomes orange. - External-tool favourites take their icon from the
.exe(SetToolIcon→icon.ToBitmap()). Those are always coloured and all get inverted.
The monochrome PNGs in Resources (
File_open,bookmark_bubbles, …) are fine. One option is to only invert images that come from Resources, or to ship light variants of those glyphs. - The tail button image (
OnRenderItemImage replaces the base method without calling it
- Disabled items are no longer greyed out, so disabled buttons look exactly like enabled ones.
e.ImageAttributesis ignored, soImageTransparentColor = Magentano longer works.- It sets
InterpolationMode,SmoothingModeandPixelOffsetModeon the sharede.Graphicsand never resets them, so later painting is affected too.
Global scope
ToolStripManager.RendererandVisualStylesEnabled = falseapply to the whole process.- Every ToolStrip and ContextMenuStrip that uses
ManagerRenderModegets the dark renderer and the inversion. That includes the tab context menu, the LogWindow context menus, the BookmarkWindow menu and plugin UIs, not just the main bars. Please check those. - The settings are made in the
LogTabWindowconstructor, so every new window sets them again.
- Every ToolStrip and ContextMenuStrip that uses
- Nothing resets them when switching back to light mode. That's only acceptable because changing the colour mode needs a restart. Please say so in a comment.
Text colour
OnRenderItemTextreplaces any text colour with brightness ≤ 0.5, not only the default black. Text that was deliberately coloured is overridden too.
Consistency
- The PR says it uses a soft off-white (220, 220, 220) instead of pure white. But
ColorComboBoxusesBrushes.White, and theHighlightEntryDialogpreview falls back toColor.White. The preview then doesn't match the grid, which now draws 220.PaintHelper.GetForeColorFromHighlightEntry, or the same constant, would keep them in line. Color.FromArgb(220, 220, 220)is hard-coded in bothPaintHelperand the renderer.DarkToolStripColorTablehard-codes a second VS2015 palette. DockPanel already usesVS2015DarkTheme, whoseColorPalettecould supply these colours.PaintHelper.BookmarkMarkerTextColorreadsApplication.IsDarkModeEnableddirectly. The otherPaintHelpercolour methods take abool darkModeparameter, which keeps them testable.
Structure
About 150 lines of theming (ConfigureToolStripDark, DarkToolStripRenderer, DarkToolStripColorTable) go into LogTabWindow, which is already far too large. Please move the renderer and the colour table into their own files, for example under src/LogExpert.UI/Theming/.
Smaller points
LogWindowoverridesBookmarkColor/AutoBookmarkColorin dark mode but has noelsebranch. That's fine as long as the theme is never applied again at runtime.ColorComboBoxcreatesnew SolidBrush(rectColor)on every paint and never disposes it. The leak was already there, but since that hunk is edited anyway, ausingwould fix it.using System.Windows.Forms;inHighlightEntryDialog.csandLedIndicatorService.csisn't needed, because implicit usings are on.
Tests
None were added. PaintHelperTests and LedIndicatorServiceTests already exist. Please cover BookmarkMarkerTextColor, the dark foreground colour and the LED dark-mode colours.
The renderer and colour table lived inside LogTabWindow and carried a palette of their own, so the toolbars drifted from the dock panel colours. Move both into LogExpert.UI/Theming, build them on the VS2015DarkTheme palette the dock panel already uses, and install them process-wide from ToolStripTheme so every strip in ManagerRenderMode picks them up. PaintHelper gains GetDefaultBackColor, GetDefaultForeColor and GetBookmarkMarkerTextColor(bool). The grid, the colour combo box, the highlight dialog and the LED indicator now take their colours from those instead of repeating the dark-mode ternaries, which is what let the highlight preview and the grid disagree. Adds tests for the renderer, the marker colour and the dark LED lookup.


Summary of changes
ToolStrip dark adaptation (LogTabWindow.cs)
Hard-coded color fixes
Test plan
Risk