Skip to content

Indeterminate and checked ToolStripMenuItem icons are now clearly visible in dark mode on ContextMenuStrip, MenuStrip, StatusStrip and ToolStrip drop-down buttons.#14317

Open
ricardobossan wants to merge 3 commits intodotnet:mainfrom
ricardobossan:Issue_11933_DarkMode_Icon_Barely_Visible
Open

Conversation

@ricardobossan
Copy link
Member

@ricardobossan ricardobossan commented Feb 20, 2026

Fixes #11933

Root Cause

ToolStripRenderer.OnRenderItemCheck only inverted the check mark glyph when SystemInformation.HighContrast was true. In regular dark mode the check mark icons (designed for light backgrounds) were drawn as-is, resulting in a dark glyph on a dark background.

Proposed changes

Extended the inversion logic in ToolStripRenderer.OnRenderItemCheck to also trigger when Application.IsDarkModeEnabled is true, using the existing ControlPaint.CreateBitmapWithInvertedForeColor helper. The high contrast path is preserved as a separate branch since it already handles its own background-color detection.

Customer Impact

Indeterminate and checked ToolStripMenuItem icons are now clearly visible in dark mode on ContextMenuStrip, MenuStrip, StatusStrip and ToolStrip drop-down buttons.

Regression?

No

Risk

Minimal

Screenshots

Before

11933-before

After

11933-after

Test methodology

Manual

Test environment(s)

  • 11.0.100-preview.1.26078.121
Microsoft Reviewers: Open in CodeFlow

`ToolStripRenderer.OnRenderItemCheck` only inverted the check mark glyph when `SystemInformation.HighContrast` was true. In regular dark mode the check mark icons (designed for light backgrounds) were drawn as-is, resulting in a dark glyph on a dark background.

Extended the inversion logic in `ToolStripRenderer.OnRenderItemCheck` to also trigger when `Application.IsDarkModeEnabled` is true, using the existing `ControlPaint.CreateBitmapWithInvertedForeColor` helper. The high contrast path is preserved as a separate branch since it already handles its own background-color detection.

Indeterminate and checked `ToolStripMenuItem` icons are now clearly visible in dark mode on `ContextMenuStrip`, `MenuStrip`, `StatusStrip` and `ToolStrip` drop-down buttons.

No

Minimal

Manual

- 11.0.100-preview.1.26078.121
@ricardobossan ricardobossan self-assigned this Feb 20, 2026
@ricardobossan ricardobossan requested a review from a team as a code owner February 20, 2026 23:10
@github-actions github-actions bot added the area-DarkMode Issues relating to Dark Mode feature label Feb 20, 2026
@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 26.08696% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.24331%. Comparing base (c7ffcb5) to head (b09d495).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14317         +/-   ##
===================================================
+ Coverage   77.21743%   77.24331%   +0.02588%     
===================================================
  Files           3279        3280          +1     
  Lines         645138      645129          -9     
  Branches       47730       47737          +7     
===================================================
+ Hits          498159      498319        +160     
+ Misses        143289      143117        -172     
- Partials        3690        3693          +3     
Flag Coverage Δ
Debug 77.24331% <26.08696%> (+0.02588%) ⬆️
integration 19.07671% <0.00000%> (+0.00799%) ⬆️
production 52.18576% <26.08696%> (+0.04749%) ⬆️
test 97.41580% <ø> (+0.01100%) ⬆️
unit 49.57633% <26.08696%> (+0.07717%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SimonZhao888
Copy link
Member

LGTM!

SimonZhao888
SimonZhao888 previously approved these changes Feb 24, 2026
@dotnet-policy-service dotnet-policy-service bot added the waiting-author-feedback The team requires more information from the author label Feb 24, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a visibility issue where checked and indeterminate ToolStripMenuItem icons were barely visible in dark mode because the dark check mark glyphs designed for light backgrounds were rendered as-is on dark backgrounds.

Changes:

  • Extended the inversion logic in ToolStripRenderer.OnRenderItemCheck to trigger for dark mode in addition to high contrast mode
  • Used ControlPaint.CreateBitmapWithInvertedForeColor to invert check mark glyphs when Application.IsDarkModeEnabled is true

@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback The team requires more information from the author label Feb 25, 2026
@LeafShi1
Copy link
Member

Please consider Copilot's comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-DarkMode Issues relating to Dark Mode feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dark Mode] Indeterminate CheckState icon barely visible

4 participants