feat: extract color resources.

This commit is contained in:
Zhang Dian
2025-03-29 15:04:28 +08:00
parent 3f67c32f03
commit 051b137121
8 changed files with 52 additions and 13 deletions

View File

@@ -58,7 +58,7 @@
</Style>
<Style Selector="^ /template/ Border#PART_BorderSeparator">
<Setter Property="Background" Value="{DynamicResource SemiColorBorder}" />
<Setter Property="Background" Value="{DynamicResource TabControlSeparatorBorderBrush}" />
</Style>
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
@@ -216,7 +216,7 @@
</Setter>
<Style Selector="^ /template/ Border#PART_BorderSeparator">
<Setter Property="Background" Value="{DynamicResource SemiColorBorder}" />
<Setter Property="Background" Value="{DynamicResource TabControlSeparatorBorderBrush}" />
</Style>
<Style Selector="^[TabStripPlacement=Left], ^[TabStripPlacement=Right]">

View File

@@ -101,7 +101,7 @@
</Style>
<Style Selector="^[TabStripPlacement=Left], ^[TabStripPlacement=Right]">
<Style Selector="^:selected /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorPrimaryLight}" />
<Setter Property="Background" Value="{DynamicResource TabItemLineHeaderSelectedBackground}" />
</Style>
</Style>
@@ -114,10 +114,10 @@
</Style>
<Style Selector="^[TabStripPlacement=Left], ^[TabStripPlacement=Right]">
<Style Selector="^:pointerover /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
<Setter Property="Background" Value="{DynamicResource TabItemLineHeaderPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorFill1}" />
<Setter Property="Background" Value="{DynamicResource TabItemLineHeaderPressedBackground}" />
</Style>
</Style>
</Style>
@@ -147,18 +147,18 @@
BasedOn="{StaticResource BaseTabItem}"
TargetType="TabItem">
<Setter Property="Padding" Value="12 8" />
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorBorder}" />
<Setter Property="BorderBrush" Value="{DynamicResource TabControlSeparatorBorderBrush}" />
<Style Selector="^:selected /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorBackground0}" />
<Setter Property="Background" Value="{DynamicResource TabItemCardHeaderSelectedBackground}" />
</Style>
<Style Selector="^:not(:selected)">
<Style Selector="^:pointerover /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
<Setter Property="Background" Value="{DynamicResource TabItemCardHeaderPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorFill1}" />
<Setter Property="Background" Value="{DynamicResource TabItemCardHeaderPressedBackground}" />
</Style>
</Style>
@@ -201,16 +201,16 @@
<Setter Property="CornerRadius" Value="{DynamicResource SemiBorderRadiusSmall}" />
<Style Selector="^:selected /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiColorPrimary}" />
<Setter Property="Background" Value="{DynamicResource SemiColorPrimaryLight}" />
<Setter Property="Foreground" Value="{DynamicResource TabItemButtonHeaderSelectedForeground}" />
<Setter Property="Background" Value="{DynamicResource TabItemButtonHeaderSelectedBackground}" />
</Style>
<Style Selector="^:not(:selected)">
<Style Selector="^:pointerover /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
<Setter Property="Background" Value="{DynamicResource TabItemButtonHeaderPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Background" Value="{DynamicResource SemiColorFill1}" />
<Setter Property="Background" Value="{DynamicResource TabItemButtonHeaderPressedBackground}" />
</Style>
</Style>

View File

@@ -1,2 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TabControlSeparatorBorderBrush" ResourceKey="SemiColorBorder" />
</ResourceDictionary>

View File

@@ -7,4 +7,16 @@
<StaticResource x:Key="TabItemLineHeaderForeground" ResourceKey="SemiColorText2" />
<StaticResource x:Key="TabItemLineHeaderPointeroverForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TabItemLineHeaderSelectedForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TabItemLineHeaderSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TabItemLineHeaderPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="TabItemLineHeaderPressedBackground" ResourceKey="SemiColorFill1" />
<!-- Card -->
<StaticResource x:Key="TabItemCardHeaderSelectedBackground" ResourceKey="SemiColorBackground0" />
<StaticResource x:Key="TabItemCardHeaderPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="TabItemCardHeaderPressedBackground" ResourceKey="SemiColorFill1" />
<!-- Button -->
<StaticResource x:Key="TabItemButtonHeaderSelectedForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="TabItemButtonHeaderSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TabItemButtonHeaderPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="TabItemButtonHeaderPressedBackground" ResourceKey="SemiColorFill1" />
</ResourceDictionary>

View File

@@ -1,2 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TabControlSeparatorBorderBrush" ResourceKey="SemiColorWindowText" />
</ResourceDictionary>

View File

@@ -7,4 +7,16 @@
<StaticResource x:Key="TabItemLineHeaderForeground" ResourceKey="SemiColorWindowText" />
<StaticResource x:Key="TabItemLineHeaderPointeroverForeground" ResourceKey="SemiColorWindowText" />
<StaticResource x:Key="TabItemLineHeaderSelectedForeground" ResourceKey="SemiColorWindowText" />
<StaticResource x:Key="TabItemLineHeaderSelectedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="TabItemLineHeaderPointeroverBackground" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="TabItemLineHeaderPressedBackground" ResourceKey="SemiColorHighlightText" />
<!-- Card -->
<StaticResource x:Key="TabItemCardHeaderSelectedBackground" ResourceKey="SemiColorHighlight" />
<StaticResource x:Key="TabItemCardHeaderPointeroverBackground" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="TabItemCardHeaderPressedBackground" ResourceKey="SemiColorHighlightText" />
<!-- Button -->
<StaticResource x:Key="TabItemButtonHeaderSelectedForeground" ResourceKey="SemiColorHighlight" />
<StaticResource x:Key="TabItemButtonHeaderSelectedBackground" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="TabItemButtonHeaderPointeroverBackground" ResourceKey="SemiColorHighlightText" />
<StaticResource x:Key="TabItemButtonHeaderPressedBackground" ResourceKey="SemiColorHighlightText" />
</ResourceDictionary>

View File

@@ -1,2 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TabControlSeparatorBorderBrush" ResourceKey="SemiColorBorder" />
</ResourceDictionary>

View File

@@ -7,4 +7,16 @@
<StaticResource x:Key="TabItemLineHeaderForeground" ResourceKey="SemiColorText2" />
<StaticResource x:Key="TabItemLineHeaderPointeroverForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TabItemLineHeaderSelectedForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TabItemLineHeaderSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TabItemLineHeaderPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="TabItemLineHeaderPressedBackground" ResourceKey="SemiColorFill1" />
<!-- Card -->
<StaticResource x:Key="TabItemCardHeaderSelectedBackground" ResourceKey="SemiColorBackground0" />
<StaticResource x:Key="TabItemCardHeaderPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="TabItemCardHeaderPressedBackground" ResourceKey="SemiColorFill1" />
<!-- Button -->
<StaticResource x:Key="TabItemButtonHeaderSelectedForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="TabItemButtonHeaderSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TabItemButtonHeaderPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="TabItemButtonHeaderPressedBackground" ResourceKey="SemiColorFill1" />
</ResourceDictionary>