Fix SimpleTheme focus adorner contrast in dark mode - #21753
Conversation
40ca69e to
92ce498
Compare
|
You can test this PR using the following package version. |
|
|
@cla-avalonia agree |
| public class AdornerLayerTests : ScopedTestBase | ||
| { | ||
| [Fact] | ||
| public void Default_Focus_Adorner_Uses_Dark_Theme_Foreground() |
There was a problem hiding this comment.
While I'm usually always asking for more tests, I think this case one is redundant: it does not test the AdornerLayer itself but rather the value of a single property on a given theme, which would need to be updated if we decide to change the color. In other words, it won't catch anything. Please remove it.
There was a problem hiding this comment.
Removed as requested. The PR now only contains the XAML theme change. Thanks!
|
You can test this PR using the following package version. |
* Add regression test for SimpleTheme focus adorner * Fix SimpleTheme focus adorner in dark mode * Remove redundant focus adorner test
What does the pull request do?
Updates SimpleTheme's default focus adorner to use the theme-aware
ThemeForegroundBrush.What is the current behavior?
The default focus rectangle always uses a black stroke, which has insufficient contrast against dark backgrounds.
What is the updated/expected behavior with this PR?
The focus rectangle uses the foreground brush for the active theme: black in the light theme and
#FFDEDEDEin the dark theme.Verified with:
Avalonia.Controls.UnitTests: 3,636 total, 3,635 passed, 0 failed, 1 pre-existing skipped test.How was the solution implemented (if it's not obvious)?
Replaced the hard-coded
Stroke=Blackvalue in SimpleTheme'sAdornerLayercontrol theme with a dynamic reference toThemeForegroundBrush.Checklist
Breaking changes
None.
Obsoletions / Deprecations
None.
Fixed issues
Fixes #18312