Skip to content

Conversation

@LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Jan 14, 2026

Fixes dotnet/winforms#14140

Update AlternateSystemColors of the KnownColorTable to match expected value

Copilot AI review requested due to automatic review settings January 14, 2026 07:59
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 14, 2026
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 14, 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 incorrect color values in the AlternateSystemColors array used for dark mode in Windows Forms. Five system colors were returning incorrect values (black or near-black/gray) when they should have been returning white (0xFFFFFFFF) according to their documentation.

Changes:

  • Fixed HighlightText, MenuText, WindowFrame, WindowText, and ButtonHighlight to return white (0xFFFFFFFF) instead of black/dark gray values in dark mode

@skyoxZ
Copy link
Contributor

skyoxZ commented Jan 14, 2026

// These values were based on manual investigation of dark mode themes in the
// Win32 Common Controls and WinUI. There aren't direct mappings published by
// Windows, these may change slightly when this feature is finalized to make
// sure we have the best experience in hybrid dark mode scenarios (mixing
// WPF, WinForms, and WinUI).

I’m curious about how the error occurred. Why are there 5 incorrect values and all related to white color? Is there anything else that needs to be fixed?

@jkotas jkotas added area-System.Drawing and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 14, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-drawing
See info in area-owners.md if you want to be subscribed.

@LeafShi1
Copy link
Member Author

LeafShi1 commented Jan 16, 2026

dotnet/winforms#14140

Based on the historical records, this enumeration class has been in its current state since its initial addition, and no one has modified it.

Furthermore, according to the original comment, Windows does not provide a direct mapping, so these values ​​are not the final or optimal mapping values. The current changes are only due to customer feedback – in dark mode, HighlightText should return white. Therefore, I checked all items commented as white.

Regarding the other items, I'm not sure if they are reasonable. @JeremyKuhne @KlausLoeffelmann How can we determine their reasonableness? Do you have any good suggestions on this?
This issue is solely for fixing the dotnet/winforms#14140 problem. For ease of review, I have removed the modifications to other parts.

@KlausLoeffelmann
Copy link
Member

All fair points. As per our discussions, the right choice of color in terms of what "counts" as the correct complementary SystemColor to the original classic code color, can be opinionated.

@JeremyKuhne and I had a longer discussing at the time about this, and if I remember correctly, on this, we were pretty quickly in an agreement that

  • a) A dark mode color is not necessarily the XOR opposite of the correlating white mode color.

  • And b) People will have different opinions, what a "right" color here will be.

We have done quite some research in different UIs stacks to find a good and accessible compromise. Have we done it correctly? I don't know if there is a real "correct" per se.

The moment we would really run into accessibility issues with a common color combination, which worked in classic mode but not in dark mode, we would probably discuss changing it.

I agree that that is not the case here. If @JeremyKuhne would also agree, I am seconding closing this PR and leave it as it is.

@JeremyKuhne
Copy link
Member

@KlausLoeffelmann agreed.

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

Labels

area-System.Drawing community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dark Mode] Incorrect HighlightText system color

5 participants