Fix toolbar background colors for dark themes #2541
Merged
+34
−1
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.
Problem
CKAN's toolbars are hideous with a dark theme:
Cause
See mono/mono#11287; Mono is trying to use
SystemColors.ButtonFace
for the left edge of a toolstrip, fading to a hard coded light color with a linear gradient. But Mono doesn't loadButtonFace
from the system settings, instead leaving it with a compile time default.Upstream fix
mono/mono#11287 is trying to fix this in Mono by switching from
ButtonFace
toSystemColors.Control
, which is set by Mono's theme loader. However, there are some downsides:Changes
Luckily this part of Mono is 90% customization / overrides / defaults / etc., so there are plenty of hooks here for us to make it work however we want. When Mono wants to draw a control, it first checks whether that control has a
.Renderer
property, and if it does, it delegates the drawing to that object. Now we populate that property with our own renderer that just draws the background color normally. This looks better than the renderer built into Mono, even after the other fix, and will work for all users regardless of their version of Mono.Fixes #2525.