Fix grid colors for dark themes #2529
Merged
+2
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Windows (and by extension .NET, and by further extension Mono) has a color theming system with two main pairs of foreground/background colors:
SystemColors.Control
SystemColors.ControlText
SystemColors.Window
SystemColors.WindowText
Problem
The mod list looks bad in Linux with a dark theme:
Cause
Mono's
DataGridView
has some bad defaults for its colors; theWindowText
andControlText
colors are switched:SystemColors.Control
SystemColors.WindowText
SystemColors.Window
SystemColors.ControlText
https://github.com/mono/mono/blob/f0921fd850b0c8e61d5954fa71471189d2a55447/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridView.cs#L176-L177
https://github.com/mono/mono/blob/f0921fd850b0c8e61d5954fa71471189d2a55447/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridView.cs#L191-L192
On a standard theme, both foreground colors are black, so this is not noticeable. On a dark theme,
ControlText
is light andControl
is dark, so the mismatch is very apparent.Submitted mono/mono#10944 to hopefully get this fixed upstream.
Changes
Luckily the defaults can be controlled by applications; now we:
ControlText
since it is a 3D control.WindowText
to make them match their backgroundThis fixes part of #2525 (we can't fix the menu or toolbar unless mono/mono#10942 is merged).
Alternate approaches considered and not done
We could try to make the grid background dark instead of white. This would be done by setting it to
SystemColors.Control
. However, this would mess up non-dark themes, making the control the color of a button.