feature: add two color keys Color.DecoratorBranch and Color.DecoratorTag (#225)

This commit is contained in:
leo 2024-07-01 16:27:22 +08:00
parent 6dad466eef
commit fca20965f8
No known key found for this signature in database
6 changed files with 18 additions and 18 deletions

View file

@ -110,6 +110,10 @@ This app supports open repository in external tools listed in the table below.
| Color.BadgeFG | Badge foreground color |
| Color.Conflict | Conflict panel background color |
| Color.ConflictForeground | Conflict panel foreground color |
| Color.DecoratorIconBG | Background color for commit ref icon |
| Color.DecoratorIcon | Foreground color for commit ref icon |
| Color.DecoratorBranch | Background color for commit branch ref name |
| Color.DecoratorTag | Background color for commit tag ref name |
| Color.Border0 | Border color used in some controls, like Window, Tab, Toolbar, etc. |
| Color.Border1 | Border color used in inputs, like TextBox, ComboBox, etc. |
| Color.Border2 | Border color used in visual lines, like seperators, Rectange, etc. |

View file

@ -11,8 +11,8 @@ namespace SourceGit.Converters
new FuncValueConverter<Models.DecoratorType, IBrush>(v =>
{
if (v == Models.DecoratorType.Tag)
return Models.DecoratorResources.Backgrounds[0];
return Models.DecoratorResources.Backgrounds[1];
return Application.Current.FindResource("Brush.DecoratorTag") as IBrush;
return Application.Current.FindResource("Brush.DecoratorBranch") as IBrush;
});
public static readonly FuncValueConverter<Models.DecoratorType, StreamGeometry> ToIcon =

View file

@ -1,6 +1,4 @@
using Avalonia.Media;
namespace SourceGit.Models
namespace SourceGit.Models
{
public enum DecoratorType
{
@ -17,12 +15,4 @@ namespace SourceGit.Models
public DecoratorType Type { get; set; } = DecoratorType.None;
public string Name { get; set; } = "";
}
public static class DecoratorResources
{
public static readonly IBrush[] Backgrounds = [
new SolidColorBrush(0xFF02C302),
new SolidColorBrush(0xFFFFB835),
];
}
}

View file

@ -13,8 +13,10 @@
<Color x:Key="Color.Contents">#FFFAFAFA</Color>
<Color x:Key="Color.Badge">#FFB0CEE8</Color>
<Color x:Key="Color.BadgeFG">#FF1F1F1F</Color>
<Color x:Key="Color.Decorator">#FF6F6F6F</Color>
<Color x:Key="Color.DecoratorIconBG">#FF6F6F6F</Color>
<Color x:Key="Color.DecoratorIcon">#FFF8F8F8</Color>
<Color x:Key="Color.DecoratorBranch">#FFFFB835</Color>
<Color x:Key="Color.DecoratorTag">#FF02C302</Color>
<Color x:Key="Color.Conflict">#FF836C2E</Color>
<Color x:Key="Color.ConflictForeground">#FFFFFFFF</Color>
<Color x:Key="Color.Border0">#FFCFCFCF</Color>
@ -43,8 +45,10 @@
<Color x:Key="Color.Contents">#FF1B1B1B</Color>
<Color x:Key="Color.Badge">#FF8F8F8F</Color>
<Color x:Key="Color.BadgeFG">#FFDDDDDD</Color>
<Color x:Key="Color.Decorator">#FF505050</Color>
<Color x:Key="Color.DecoratorIconBG">#FF505050</Color>
<Color x:Key="Color.DecoratorIcon">#FFF8F8F8</Color>
<Color x:Key="Color.DecoratorBranch">#FFFFB835</Color>
<Color x:Key="Color.DecoratorTag">#FF02C302</Color>
<Color x:Key="Color.Conflict">#FFFAFAD2</Color>
<Color x:Key="Color.ConflictForeground">#FF252525</Color>
<Color x:Key="Color.Border0">#FF181818</Color>
@ -73,8 +77,10 @@
<SolidColorBrush x:Key="Brush.Contents" Color="{DynamicResource Color.Contents}"/>
<SolidColorBrush x:Key="Brush.Badge" Color="{DynamicResource Color.Badge}"/>
<SolidColorBrush x:Key="Brush.BadgeFG" Color="{DynamicResource Color.BadgeFG}"/>
<SolidColorBrush x:Key="Brush.Decorator" Color="{DynamicResource Color.Decorator}"/>
<SolidColorBrush x:Key="Brush.DecoratorIconBG" Color="{DynamicResource Color.DecoratorIconBG}"/>
<SolidColorBrush x:Key="Brush.DecoratorIcon" Color="{DynamicResource Color.DecoratorIcon}"/>
<SolidColorBrush x:Key="Brush.DecoratorBranch" Color="{DynamicResource Color.DecoratorBranch}"/>
<SolidColorBrush x:Key="Brush.DecoratorTag" Color="{DynamicResource Color.DecoratorTag}"/>
<SolidColorBrush x:Key="Brush.Conflict" Color="{DynamicResource Color.Conflict}"/>
<SolidColorBrush x:Key="Brush.ConflictForeground" Color="{DynamicResource Color.ConflictForeground}"/>
<SolidColorBrush x:Key="Brush.Border0" Color="{DynamicResource Color.Border0}"/>

View file

@ -90,7 +90,7 @@
<DataTemplate DataType="{x:Type m:Decorator}">
<Border Height="16" Margin="0,0,6,0" CornerRadius="2" ClipToBounds="True">
<StackPanel Orientation="Horizontal">
<Border Background="{DynamicResource Brush.Decorator}" Width="16">
<Border Background="{DynamicResource Brush.DecoratorIconBG}" Width="16">
<Path Width="8" Height="8" Data="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToIcon}}" Fill="{DynamicResource Brush.DecoratorIcon}"/>
</Border>
<Border Background="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToBackground}}">

View file

@ -46,7 +46,7 @@
<DataTemplate DataType="{x:Type m:Decorator}">
<Border Height="16" Margin="0,0,4,0" CornerRadius="2" ClipToBounds="True">
<StackPanel Orientation="Horizontal">
<Border Background="{DynamicResource Brush.Decorator}" Width="16">
<Border Background="{DynamicResource Brush.DecoratorIconBG}" Width="16">
<Path Width="8" Height="8"
Stretch="Uniform"
Data="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToIcon}}"