Skip to content

Commit c1890c4

Browse files
carlos-zamoraDHowett
authored andcommitted
Fix High Contrast mode in Settings UI (#18130)
"HighContrast" is not a possible requested theme. So `_UpdateBackgroundForMica()` would force the settings UI to be light or dark. To fix this, we just check if we're in high contrast mode and, if so, we don't bother setting the requested theme. (cherry picked from commit d04381e) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgUZ6Mc Service-Version: 1.22
1 parent 5f614bc commit c1890c4

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/cascadia/TerminalSettingsEditor/MainPage.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
682682
// can have mica too.
683683
void MainPage::_UpdateBackgroundForMica()
684684
{
685+
// If we're in high contrast mode, don't override the theme.
686+
if (Windows::UI::ViewManagement::AccessibilitySettings accessibilitySettings; accessibilitySettings.HighContrast())
687+
{
688+
return;
689+
}
690+
685691
bool isMicaAvailable = false;
686692

687693
// Check to see if our hosting window supports Mica at all. We'll check

src/cascadia/TerminalSettingsEditor/MainPage.xaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@
4444
<ResourceDictionary x:Key="HighContrast">
4545
<!-- Define resources for HighContrast mode here -->
4646
<StaticResource x:Key="SettingsPageBackground"
47-
ResourceKey="SystemColorWindowColorBrush" />
47+
ResourceKey="SystemColorWindowBrush" />
4848
<StaticResource x:Key="SettingsPageMicaBackground"
49-
ResourceKey="SystemColorWindowColorBrush" />
49+
ResourceKey="SystemColorWindowBrush" />
5050
</ResourceDictionary>
51-
5251
</ResourceDictionary.ThemeDictionaries>
5352
</ResourceDictionary>
5453

src/cascadia/TerminalSettingsEditor/pch.h

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <winrt/Windows.UI.Input.h>
3232
#include <winrt/Windows.UI.Popups.h>
3333
#include <winrt/Windows.UI.Text.h>
34+
#include <winrt/Windows.UI.ViewManagement.h>
3435
#include <winrt/Windows.UI.Xaml.h>
3536
#include <winrt/Windows.UI.Xaml.Automation.h>
3637
#include <winrt/Windows.UI.Xaml.Automation.Peers.h>

0 commit comments

Comments
 (0)