From 182a3bb573d1b162bf0424dc06d3eb43c9cd6787 Mon Sep 17 00:00:00 2001 From: jtippet Date: Wed, 8 Jul 2020 12:08:08 -0700 Subject: [PATCH] Make Terminal look great in High Contrast (#6833) This PR enables `ApplicationHighContrastAdjustment::None`. Doing this disables a set of mitigations in XAML designed to band-aid apps that were never explicitly designed for High Contrast (HC) modes. Terminal now has full control of and responsibility for its appearance in HC mode. This allows Terminal to look a lot better. On paper, we should be able to set `HighContrastAdjustment="None"` on the `` element. But that doesn't have any effect. I don't know if this is a bug in `` or somewhere else. So instead I set the property in codebehind, which is not as ideal, but does at least work. I'd love to a way to move this into App.xaml. The Find box had a couple stray styles to override the ToggleButton's foreground color. With backplating removed, these styles became actively harmful (white foreground on highlight color background), so I just removed them. The built-in style for ToggleButton is perfect as-is. Closes #5360 --- .github/actions/spell-check/dictionary/microsoft.txt | 1 + src/cascadia/TerminalApp/App.cpp | 5 +++++ src/cascadia/TerminalControl/SearchBoxControl.xaml | 9 +-------- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/actions/spell-check/dictionary/microsoft.txt b/.github/actions/spell-check/dictionary/microsoft.txt index 960efdbd7..5e5d2ee31 100644 --- a/.github/actions/spell-check/dictionary/microsoft.txt +++ b/.github/actions/spell-check/dictionary/microsoft.txt @@ -1,4 +1,5 @@ ACLs +backplating DACL DACLs LKG diff --git a/src/cascadia/TerminalApp/App.cpp b/src/cascadia/TerminalApp/App.cpp index 0c7ff464d..8e5022a69 100644 --- a/src/cascadia/TerminalApp/App.cpp +++ b/src/cascadia/TerminalApp/App.cpp @@ -26,6 +26,11 @@ namespace winrt::TerminalApp::implementation } Initialize(); + + // Disable XAML's automatic backplating of text when in High Contrast + // mode: we want full control of and responsibility for the foreground + // and background colors that we draw in XAML. + HighContrastAdjustment(::winrt::Windows::UI::Xaml::ApplicationHighContrastAdjustment::None); } AppLogic App::Logic() diff --git a/src/cascadia/TerminalControl/SearchBoxControl.xaml b/src/cascadia/TerminalControl/SearchBoxControl.xaml index 54a21fe30..f64ae36ff 100644 --- a/src/cascadia/TerminalControl/SearchBoxControl.xaml +++ b/src/cascadia/TerminalControl/SearchBoxControl.xaml @@ -36,7 +36,6 @@ - - - @@ -188,8 +182,7 @@ - +