mirror of
https://github.com/microsoft/terminal.git
synced 2026-07-08 17:46:05 +00:00
This reverts commit 3ab2acc2ad aka Fix
Settings tab color mismatch with Settings page background (#19999).
Closes #20186
Re-opens #19873
254 lines
16 KiB
XML
254 lines
16 KiB
XML
<!--
|
|
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
|
|
the MIT License. See LICENSE in the project root for license information.
|
|
-->
|
|
<Application x:Class="TerminalApp.App"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="using:TerminalApp"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
|
|
mc:Ignorable="d">
|
|
<!--
|
|
If you want to prove this works, then add `RequestedTheme="Light"` to
|
|
the properties on the XamlApplication
|
|
-->
|
|
<Application.Resources>
|
|
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<!-- Include the MUX Controls resources -->
|
|
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"
|
|
ControlsResourcesVersion="Version2" />
|
|
<ResourceDictionary>
|
|
|
|
<!--
|
|
We're going to apply this style to the root Grid acting
|
|
as the tab row, because we need to be able to set its
|
|
`Background` property to "{ThemeResource
|
|
ApplicationPageBackgroundThemeBrush}" so it will be colored
|
|
appropriately for the theme, regardless of what we set the
|
|
RequestedTheme to
|
|
-->
|
|
<Style x:Name="BackgroundGridThemeStyle"
|
|
TargetType="Grid">
|
|
<Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
|
|
</Style>
|
|
|
|
<!--
|
|
We need to manually create the error text brush as a
|
|
theme-dependent brush. SystemControlErrorTextForegroundBrush
|
|
is unfortunately static.
|
|
-->
|
|
<SolidColorBrush x:Name="ErrorTextBrush"
|
|
Color="{ThemeResource SystemErrorTextColor}" />
|
|
|
|
<!-- Suppress top padding -->
|
|
<Thickness x:Key="TabViewHeaderPadding">0,0,0,0</Thickness>
|
|
|
|
<Thickness x:Key="TabViewItemBorderThickness">1,1,1,0</Thickness>
|
|
|
|
<!--
|
|
Disable the EntranceThemeTransition for our muxc:TabView, which would slowly slide in the tabs
|
|
while the window opens. The difference is especially noticeable if window fade-in transitions are
|
|
disabled system-wide. On my system this shaves off about 10% of the startup cost and looks better.
|
|
-->
|
|
<Style TargetType="primitives:TabViewListView">
|
|
<Setter Property="ItemContainerTransitions">
|
|
<Setter.Value>
|
|
<TransitionCollection>
|
|
<AddDeleteThemeTransition />
|
|
<ContentThemeTransition />
|
|
<ReorderThemeTransition />
|
|
</TransitionCollection>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- Shadow that can be used by any control. -->
|
|
<ThemeShadow x:Name="SharedShadow" />
|
|
|
|
<!-- Colored button which changes on hover/press -->
|
|
<Style x:Key="ColorButtonStyle"
|
|
TargetType="Button">
|
|
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
|
|
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
|
|
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
|
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
|
|
<Setter Property="FocusVisualMargin" Value="-3" />
|
|
<Setter Property="Width" Value="32" />
|
|
<Setter Property="Height" Value="32" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Grid>
|
|
<Border x:Name="ColorButtonBackground"
|
|
Background="{TemplateBinding Background}"
|
|
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal" />
|
|
|
|
<VisualState x:Name="PointerOver">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
|
Storyboard.TargetProperty="Opacity">
|
|
<DiscreteObjectKeyFrame KeyTime="0"
|
|
Value="0.9" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
|
Storyboard.TargetProperty="BorderBrush">
|
|
<DiscreteObjectKeyFrame KeyTime="0"
|
|
Value="{ThemeResource ButtonBorderBrushPointerOver}" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
|
|
<VisualState x:Name="Pressed">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
|
Storyboard.TargetProperty="Opacity">
|
|
<DiscreteObjectKeyFrame KeyTime="0"
|
|
Value="0.8" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
|
Storyboard.TargetProperty="BorderBrush">
|
|
<DiscreteObjectKeyFrame KeyTime="0"
|
|
Value="{ThemeResource ButtonBorderBrushPressed}" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
|
|
<VisualState x:Name="Disabled">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
|
Storyboard.TargetProperty="Background">
|
|
<DiscreteObjectKeyFrame KeyTime="0"
|
|
Value="{ThemeResource ButtonBackgroundDisabled}" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
|
Storyboard.TargetProperty="BorderBrush">
|
|
<DiscreteObjectKeyFrame KeyTime="0"
|
|
Value="{ThemeResource ButtonBorderBrushDisabled}" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!--
|
|
Remove all item animations from the suggestions UI and command
|
|
palette. They're entirely too slow to let that UI be usable.
|
|
-->
|
|
<Style x:Key="NoAnimationsPlease"
|
|
TargetType="ListView">
|
|
<Setter Property="ItemContainerTransitions">
|
|
<Setter.Value>
|
|
<TransitionCollection>
|
|
<!-- (deleted transitions are left for reference for what we removed) -->
|
|
<ContentThemeTransition />
|
|
<!--<AddDeleteThemeTransition/>-->
|
|
<!--<ReorderThemeTransition/>-->
|
|
<!--<EntranceThemeTransition IsStaggeringEnabled="False"/>-->
|
|
</TransitionCollection>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<ResourceDictionary.ThemeDictionaries>
|
|
<ResourceDictionary x:Key="Dark">
|
|
<!-- Define resources for Dark mode here -->
|
|
|
|
<!--
|
|
Originally, we were using the raw value of
|
|
ApplicationPageBackgroundThemeBrush here, which is
|
|
evaluated as SolidBackgroundFillColorBase. If we try
|
|
to use those resources directly though, we don't get
|
|
the properly themed versions. Presumably because the
|
|
App itself can't have its RequestedTheme changed at
|
|
runtime.
|
|
|
|
However, after more discussion with the WinUI
|
|
team, we determined that those colors don't
|
|
provide enough contrast. The color here (and in
|
|
light mode) were chosen for greater contrast.
|
|
|
|
See GH #12356 for more history on the subject.
|
|
-->
|
|
<SolidColorBrush x:Key="TabViewBackground"
|
|
Color="#2e2e2e" />
|
|
|
|
<StaticResource x:Key="UnfocusedBorderBrush"
|
|
ResourceKey="TabViewBackground" />
|
|
|
|
<SolidColorBrush x:Key="SettingsUiTabBrush"
|
|
Color="#0c0c0c" />
|
|
|
|
<SolidColorBrush x:Key="BroadcastPaneBorderColor"
|
|
Color="{StaticResource SystemAccentColorDark2}" />
|
|
</ResourceDictionary>
|
|
|
|
<ResourceDictionary x:Key="Light">
|
|
<!-- Define resources for Light mode here -->
|
|
|
|
<!--
|
|
GH #12398 has more history on this value, as well as GH #12400
|
|
-->
|
|
<SolidColorBrush x:Key="TabViewBackground"
|
|
Color="#e8e8e8" />
|
|
|
|
<StaticResource x:Key="UnfocusedBorderBrush"
|
|
ResourceKey="TabViewBackground" />
|
|
|
|
<SolidColorBrush x:Key="SettingsUiTabBrush"
|
|
Color="#ffffff" />
|
|
|
|
<SolidColorBrush x:Key="BroadcastPaneBorderColor"
|
|
Color="{StaticResource SystemAccentColorLight2}" />
|
|
</ResourceDictionary>
|
|
|
|
<ResourceDictionary x:Key="HighContrast">
|
|
<!-- Define resources for HighContrast mode here -->
|
|
|
|
<!--
|
|
MSFT:38264744
|
|
You'd think that if a key wasn't present in a ThemeDictionary,
|
|
it'd fall back to the original value. You'd be wrong - if you
|
|
provide a Light&dark version of a resource, but not the
|
|
HighContrast version, the resource loader will fall back to the
|
|
Light value.
|
|
|
|
SystemColorButtonFaceColorBrush is the default background color for WinUI's TabViewBackground under high contrast mode.
|
|
-->
|
|
<StaticResource x:Key="TabViewBackground"
|
|
ResourceKey="SystemColorButtonFaceColorBrush" />
|
|
|
|
<StaticResource x:Key="SettingsUiTabBrush"
|
|
ResourceKey="SystemControlBackgroundBaseLowBrush" />
|
|
|
|
<SolidColorBrush x:Key="BroadcastPaneBorderColor"
|
|
Color="{StaticResource SystemColorHighlightColor}" />
|
|
</ResourceDictionary>
|
|
|
|
</ResourceDictionary.ThemeDictionaries>
|
|
|
|
</ResourceDictionary>
|
|
|
|
<ResourceDictionary Source="ms-resource:///Files/TerminalApp/HighlightedTextControlStyle.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
</ResourceDictionary>
|
|
|
|
|
|
</Application.Resources>
|
|
</Application>
|