Skip to content

Use dark-themed images and colors in dark mode - #746

Open
mfkeeq199458 wants to merge 6 commits into
LogExperts:Developmentfrom
mfkeeq199458:feature/dark-theme-color-tuning
Open

mfkeeq199458 wants to merge 6 commits into
LogExperts:Developmentfrom
mfkeeq199458:feature/dark-theme-color-tuning

Conversation

@mfkeeq199458

@mfkeeq199458 mfkeeq199458 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Menu, toolbar and panel icons are now loaded through ThemedImages, which picks the *_dark resource variants (images/png/48_dark) when the application runs with the dark color mode, so black glyphs stay visible on dark strips. Lookups use nameof(Resources.X) instead of string literals, so a typo becomes a compile error rather than a runtime exception.

Dark-mode defaults were adjusted where fixed colors were still hardcoded: bookmark and auto-bookmark markers, the bookmark/filter 'i'/'!' marker text, LED off/tail states, the ColorComboBox items and the highlight entry preview label. Default dark-mode grid text changes from Color.White to Color.FromArgb(220, 220, 220) (soft gainsboro tone).

Resources accessors were regenerated from Resources.resx with the VS Custom Tool, which adds the 13 *_dark bitmap accessors. The regeneration ran in a Chinese-language Visual Studio 17, so the file header and doc comments are currently localized and GeneratedCodeAttribute is 17.0.0.0; @Hirogen will regenerate Resources.Designer.cs after merge to restore the English comments and 18.0.0.0. PaintHelperTests now covers GetBookmarkMarkerTextColor in light and dark mode.

Removed assets (no code references remain): Add, ArrowLeft, ArrowRight, Bookmark_added, Bookmark_manager, Bookmark_remove, Bookmarks, Check_circle, Deceased, Delete, Favorite, Folder_open and Star (13 light icons), plus LogExpert.bmp, LogExpert-Icon.gif, Icon1.ico, Icon2.ico and bubble.ico. The corresponding *_dark variants were added and removed within this PR, so only the 13 light icons are removed relative to Development. The installer and ApplicationIcon already use logexpert.ico, so the cleanup is safe.

LogTabWindow.designer.cs and its .resx also drop the embedded toolStripButtonTail.Image. The button is text-only (DisplayStyle = ToolStripItemDisplayStyle.Text) and the constructor replaces it with the follow-tail check box host, so the 16x16 bitmap was never rendered and goes away together with its resource entry.

Pro_Filter uses neutral line art that is readable on both light and dark backgrounds, so no Pro_Filter_dark variant is needed.

The change is a pivot from an earlier, never-committed approach that inverted icons at paint time via a custom ToolStrip renderer.

Menu, toolbar and panel icons are now loaded through ThemedImages,
which picks the *_dark resource variants (images/png/48_dark) when
the application runs with the dark color mode, so black glyphs stay
visible on dark strips.

Dark-mode defaults were adjusted where fixed colors were still
hardcoded: bookmark and auto-bookmark markers, the bookmark/filter
'i'/'!' marker text, LED off/tail states, the ColorComboBox items
and the highlight entry preview label.

The change is a pivot from an earlier, never-committed approach that
inverted icons at paint time via a custom ToolStrip renderer.

@Hirogen Hirogen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mfkeeq199458 — switching to proper _dark assets is much better than the paint-time inversion idea, and the dark PNGs look right (same masks, inverted glyphs). Using Application.IsDarkModeEnabled at construction matches the rest of the app and the "restart required" setting, and light mode stays unchanged.

A few things before merging:

Coverage gaps

  • LogWindow.cs:535-536: btnFilterDown / btnFilterUp still use Resources.ArrowDown / ArrowUp, even though this PR adds _dark variants for both.
  • toolStripButtonTail (LogTabWindow.designer.cs:893) and Pro_Filter (LogWindow.cs:534) stay light-only.

Contrast

  • In dark mode the 'i'/'!' marker text (220,130,20) on the new bookmark fill (140,195,240) is about 1.5:1, harder to read than in light mode. Could you pick a darker text or a darker fill?
  • LED off (170) and tail-off (175) are almost indistinguishable in dark mode; in light mode they're clearly different (100 vs 160). Please keep a visible gap.

ThemedImages

  • (Bitmap)Resources.ResourceManager.GetObject(name) triggers nullable warnings (CS8600/CS8603) and silently returns null on a typo. Please throw (or Debug.Assert) when the resource is missing, so a bad name fails loudly.
  • ApplyDarkImages also runs in light mode and replaces the designer-set bitmaps without disposing them. Either only run it when darkMode is true, or rename it to ApplyThemedImages.

Cleanup

  • 13 of the 26 _dark PNGs aren't referenced anywhere (Add, ArrowLeft/Right, Bookmarks, Bookmark_added/manager/remove, Check_circle, Deceased, Delete, Favorite, Folder_open, Star). Please drop them, or use the arrows for the filter buttons above.
  • HighlightEntryDialog.cs:409-411: please reuse PaintHelper's dark colors (GetForeColorFromHighlightEntry / GetBackColorFromHighlightEntry) instead of hardcoding them. The (32,32,32) background is a no-op anyway, since SystemColors.Window already resolves to it in dark mode.
  • ColorComboBox.cs:71: e.ForeColor would be theme- and selection-aware instead of Brushes.White/Black.
  • LedIndicatorService.cs: please revert the whitespace-only realignment and the redundant using System.Windows.Forms;.

Description

  • The default dark-mode grid text changes from White to (220,220,220) (PaintHelper.cs:107/260/275). That affects every log line, so please mention it in the PR description. I'm fine with the change itself.

Thanks again — this is close!

- Use dark arrow icons for the pro filter up/down buttons
- Darken bookmark marker text in dark mode for contrast on the light
  bookmark fills (220,130,20 -> 90,45,0, ~6:1 contrast)
- Widen gray gap between LED off-state (170 -> 110) and tail-off (175)
  in dark mode, mirroring the light-mode 100 vs 160 difference
- ThemedImages.Get now throws InvalidOperationException on a missing
  resource instead of silently returning null (also fixes CS8600/CS8603)
- Rename ApplyDarkImages to ApplyThemedImages (runs in both modes)
- HighlightEntryDialog preview: reuse PaintHelper.GetForeColorFromHighlightEntry
  defaults; revert background to SystemColors.Window ((32,32,32) was a no-op)
- ColorComboBox: draw item text with e.ForeColor instead of hardcoded
  Brushes.White/Black
- LedIndicatorService: remove redundant using System.Windows.Forms and
  whitespace-only realignment
- Remove dead image assignment on toolStripButtonTail: DisplayStyle=Text
  means the embedded image was never rendered
- Remove unused image assets: 13 unreferenced icon pairs (light + _dark)
  with their resx/Designer entries (main + de localization), plus 5
  orphaned files (LogExpert.bmp, bubble.ico, Icon1.ico, Icon2.ico,
  LogExpert-Icon.gif)
@mfkeeq199458
mfkeeq199458 requested a review from Hirogen October 23, 2026 10:37

@Hirogen Hirogen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the quick turnaround @mfkeeq199458 — almost everything from the last round is in. The new marker text is ~6.2:1 on the bookmark fill and ~6.9:1 on the auto-bookmark fill, the LED gap is clear now, the filter arrows are themed, and ThemedImages.Get throws on a missing resource.

A few small things left:

Build

  • ThemedImages.cs:11 and :17 add two CA1304 warnings (ResourceManager.GetObject(string) without a culture). Please pass CultureInfo.CurrentUICulture, or use Resources.Culture to match the generated Resources.Designer.cs.

Leftovers from the previous review

  • Pro_Filter (LogWindow.cs:534) is still light-only. A Pro_Filter_dark variant through ThemedImages would finish the set. If that's not feasible, just say so and we can track it separately.
  • Please update the PR description. It should mention that the default dark-mode grid text changes from White to (220,220,220), and list the removed assets (the 13 light/dark icon pairs, LogExpert.bmp, LogExpert-Icon.gif, Icon1.ico, Icon2.ico, bubble.ico). I checked: nothing references them, and the installer and ApplicationIcon use logexpert.ico, so the cleanup is fine. It just needs to be visible in the description.

Consistency (small)

  • PaintHelper.BookmarkMarkerTextColor reads Application.IsDarkModeEnabled directly, while the bookmark fills take a darkMode parameter. Could it be a method GetBookmarkMarkerTextColor(bool darkMode) like the other PaintHelper APIs? That keeps it testable in PaintHelperTests and stops the text and fill from disagreeing.
  • LogWindow.cs:535-537: please read Application.IsDarkModeEnabled once into a local, as :275 already does.
  • Optional: in light mode, ApplyThemedImages reloads every bitmap the designer already assigned and doesn't dispose the originals. An early if (!darkMode) return; would avoid that.

FYI, no action needed: a selected ColorComboBox item now draws its text in the highlight colour in light mode too, instead of black. I think that's an improvement. Just noting it because the PR otherwise leaves light mode unchanged.

After the warnings and the description are sorted, this is good to merge from my side. Thanks!

mfkeeq199458 and others added 2 commits October 24, 2026 09:54
Build warnings (CA1304):
- ThemedImages: pass CultureInfo.CurrentUICulture to ResourceManager.GetObject

API consistency:
- PaintHelper.BookmarkMarkerTextColor property -> GetBookmarkMarkerTextColor(bool darkMode) method, matching other PaintHelper APIs

Minor cleanup:
- LogWindow.ApplyResourceImages: cache Application.IsDarkModeEnabled into local variable
- LogTabWindow.ApplyThemedImages: early return in light mode to avoid unnecessary bitmap reloads

PR description updates (per reviewer request):
- Default dark-mode grid text changes from Color.White to Color.FromArgb(220, 220, 220) (soft gainsboro tone)
- Removed assets (no code references remain): 13 light/dark icon pairs, LogExpert.bmp, LogExpert-Icon.gif, Icon1.ico, Icon2.ico, bubble.ico
- Installer and ApplicationIcon already use logexpert.ico, cleanup is safe

Pro_Filter note:
- Pro_Filter uses neutral line art that is readable on both light and dark backgrounds, so no Pro_Filter_dark variant is needed.
@mfkeeq199458
mfkeeq199458 force-pushed the feature/dark-theme-color-tuning branch from bb7f631 to e48c0cf Compare October 24, 2026 02:13
@mfkeeq199458
mfkeeq199458 requested a review from Hirogen October 24, 2026 02:15

@Hirogen Hirogen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mfkeeq199458 — round 3 looks good. CA1304 is gone, GetBookmarkMarkerTextColor(bool darkMode) is in, the dark-mode flag is read once, and the early return in light mode is there. I also re-checked the earlier items. The arrows, contrast, LED gap, missing-resource exception, HighlightEntryDialog and ColorComboBox changes all still hold, and every name passed to ThemedImages has both a light and a _dark resource.

Three small things before merge:

1. PR description
The White → (220,220,220) note and the list of removed assets ended up in the e48c0cf commit message, but the PR description on GitHub is still the original. Please copy them into the description. One correction while you're at it: only the 13 light icons are removed from Development (Add, ArrowLeft, ArrowRight, Bookmark_added, Bookmark_manager, Bookmark_remove, Bookmarks, Check_circle, Deceased, Delete, Favorite, Folder_open, Star). Their _dark twins were added and removed within this PR, so "13 light/dark pairs" overstates it.

2. Resources.Designer.cs doc comments
Removing the 13 properties by hand left orphaned /// <summary> openers with no closing tag (e.g. lines 108–110 and 157–162; the file now has 759 <summary> vs 746 </summary>). Please regenerate the file from Resources.resx (in VS: right-click the resx → Run Custom Tool) instead of fixing it by hand.

3. Test for GetBookmarkMarkerTextColor
Could you add a case to PaintHelperTests for both modes? It covers the other darkMode helpers already, and this is what the method signature was for.

Pro_Filter: OK with leaving it light-only, given that it's neutral line art. For future readers, could you add a one-line note to the PR description too?

Optional, non-blocking: ThemedImages.Get(nameof(Resources.Arrow_menu_open), dark) instead of string literals would turn a typo into a compile error instead of a runtime exception.

With 1–3 done, I'm happy to merge. Thanks!

- Regenerate Resources.Designer.cs from Resources.resx via VS Custom Tool
- Use nameof(Resources.X) for ThemedImages lookups
- Add light/dark tests for GetBookmarkMarkerTextColor
@mfkeeq199458
mfkeeq199458 requested a review from Hirogen October 28, 2026 05:26

@Hirogen Hirogen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mfkeeq199458 — round 4 is nearly there. The PR description now has everything (grey text note, the light-only removed icons, the Pro_Filter note), the GetBookmarkMarkerTextColor tests are in for both modes, and all ThemedImages calls use nameof. I built the branch and it adds no new warnings compared to Development.

One thing before merge: Resources.Designer.cs

The file was properly regenerated this time (tags balanced, one accessor per resx entry), but it looks like the Custom Tool ran in a Chinese-language Visual Studio 17:

  • the header and all ~758 doc comments are now in Chinese (e.g. 查找类似 Copyright 的本地化字符串。)
  • GeneratedCodeAttribute went from "18.0.0.0" back to "17.0.0.0"

The rest of the repo keeps generated code in English, so please regenerate it with an English VS UI (Tools → Options → Environment → International Settings → English, then Run Custom Tool on Resources.resx), ideally on VS 2026/18 so the version stays at 18.0.0.0. If that's awkward to set up, just say so and I can regenerate it on my side after merge.

Optional, non-blocking

  • LogTabWindow.ApplyThemedImages returns early when !dark, so the 16 ThemedImages.Get(..., dark) calls after it always pass true. Passing true directly, or dropping the early return, would make that clearer.
  • The PR also removes the embedded toolStripButtonTail.Image from LogTabWindow.designer.cs/.resx. That's fine, since the button is text-only and gets replaced at runtime, but a short mention in the description would help.

With the Designer file sorted, I'm happy to merge. Thanks for sticking with this!

@Hirogen Hirogen mentioned this pull request Oct 29, 2026
The method returns early when dark mode is off, so every ThemedImages.Get call after that guard was always passing dark=true. Drop the local and use the named argument instead, with a comment saying why the guard exists.
@mfkeeq199458

mfkeeq199458 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@Hirogen - pushed 746c9b3 for the two optional items:

  • LogTabWindow.ApplyThemedImages no longer keeps a redundant dark local - the early return already implies it, so the calls now pass darkMode: true explicitly. The guard stays (light mode keeps the designer-embedded images) and now carries a comment saying so.
  • The PR description mentions the removed toolStripButtonTail.Image.

On Resources.Designer.cs: the VS here is a Chinese UI on 17.0.0.0 and I don't have an English VS 2026/18 available, so I can't regenerate it cleanly. Taking you up on your offer - please regenerate it on your side after merge. Resources.resx hasn't changed since 94745369, so the expected delta is just the file header, the doc comments going back to English, and GeneratedCodeAttribute returning to 18.0.0.0.

Both CI builds are green on 746c9b30. Could you take another look when you get a chance?

@mfkeeq199458
mfkeeq199458 requested a review from Hirogen October 30, 2026 15:56
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