Skip to content

Commit

Permalink
Fix the SUI being in the wrong Theme color (#13145)
Browse files Browse the repository at this point in the history
ThemeResources are a persistent pain.

Regressed in #13083. See also #12775 et. al.

We can't just put those here though as StaticResources, because XAML will evaluate their values when the App is first loaded, and we'll always use the value from the OS theme, regarless of the requested theme. Kinda the same thing we've had to do with TabViewBackground in the past.

* [x] Fixes something we noticed right before shipping

(cherry picked from commit bb03b00)
Service-Card-Id: 82303611
Service-Version: 1.13
  • Loading branch information
zadjii-msft authored and DHowett committed May 23, 2022
1 parent 56ad3ad commit 16f459d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
10 changes: 0 additions & 10 deletions src/cascadia/TerminalApp/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@

<StaticResource x:Key="UnfocusedBorderBrush"
ResourceKey="ApplicationPageBackgroundThemeBrush" />

<StaticResource x:Key="SettingsPageBackground"
ResourceKey="SolidBackgroundFillColorTertiary" />

</ResourceDictionary>

<ResourceDictionary x:Key="Light">
Expand All @@ -170,9 +166,6 @@

<StaticResource x:Key="UnfocusedBorderBrush"
ResourceKey="ApplicationPageBackgroundThemeBrush" />

<StaticResource x:Key="SettingsPageBackground"
ResourceKey="SolidBackgroundFillColorTertiary" />
</ResourceDictionary>

<ResourceDictionary x:Key="HighContrast">
Expand All @@ -190,9 +183,6 @@
-->
<StaticResource x:Key="TabViewBackground"
ResourceKey="SystemColorButtonFaceColorBrush" />

<StaticResource x:Key="SettingsPageBackground"
ResourceKey="SystemColorWindowColorBrush" />
</ResourceDictionary>

</ResourceDictionary.ThemeDictionaries>
Expand Down
34 changes: 32 additions & 2 deletions src/cascadia/TerminalSettingsEditor/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,43 @@
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Background="{ThemeResource SettingsPageBackground}"
mc:Ignorable="d">

<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml" />

<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>

<!--
These two values are "SolidBackgroundFillColorTertiary".
We can't just put those here though as
StaticResources, because XAML will evaluate their
values when the App is first loaded, and we'll
always use the value from the OS theme, regardless
of the requested theme. Kinda the same thing we've
had to do with TabViewBackground in the past.
-->

<ResourceDictionary x:Key="Dark">
<Color x:Key="SettingsPageBackground">#282828</Color>
</ResourceDictionary>

<ResourceDictionary x:Key="Light">
<Color x:Key="SettingsPageBackground">#F9F9F9</Color>
</ResourceDictionary>

<ResourceDictionary x:Key="HighContrast">
<!-- Define resources for HighContrast mode here -->
<StaticResource x:Key="SettingsPageBackground"
ResourceKey="SystemColorWindowColorBrush" />
</ResourceDictionary>

</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>

<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground"
Expand All @@ -30,7 +60,7 @@
</Page.Resources>

<muxc:NavigationView x:Name="SettingsNav"
Background="Transparent"
Background="{ThemeResource SettingsPageBackground}"
IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
ItemInvoked="SettingsNav_ItemInvoked"
Expand Down

0 comments on commit 16f459d

Please sign in to comment.