ux: do not use graph color for commit refs (decorators) in commit details panel

This commit is contained in:
leo 2024-10-15 09:53:22 +08:00
parent 07c2e9f927
commit b44d4d26c9
No known key found for this signature in database
4 changed files with 22 additions and 4 deletions

View file

@ -10,7 +10,7 @@
<Color x:Key="Color.Contents">#FFFAFAFA</Color> <Color x:Key="Color.Contents">#FFFAFAFA</Color>
<Color x:Key="Color.Badge">#FFB0CEE8</Color> <Color x:Key="Color.Badge">#FFB0CEE8</Color>
<Color x:Key="Color.BadgeFG">#FF1F1F1F</Color> <Color x:Key="Color.BadgeFG">#FF1F1F1F</Color>
<Color x:Key="Color.DecoratorTag">#79855f</Color> <Color x:Key="Color.DecoratorTag">DarkGreen</Color>
<Color x:Key="Color.Conflict">#FF836C2E</Color> <Color x:Key="Color.Conflict">#FF836C2E</Color>
<Color x:Key="Color.ConflictForeground">#FFFFFFFF</Color> <Color x:Key="Color.ConflictForeground">#FFFFFFFF</Color>
<Color x:Key="Color.Border0">#FFCFCFCF</Color> <Color x:Key="Color.Border0">#FFCFCFCF</Color>

View file

@ -102,7 +102,8 @@
Foreground="{DynamicResource Brush.FG1}" Foreground="{DynamicResource Brush.FG1}"
FontFamily="{DynamicResource Fonts.Primary}" FontFamily="{DynamicResource Fonts.Primary}"
FontSize="11" FontSize="11"
VerticalAlignment="Center"/> VerticalAlignment="Center"
UseGraphColor="False"/>
</Border> </Border>
<!-- Messages --> <!-- Messages -->

View file

@ -46,6 +46,15 @@ namespace SourceGit.Views
set => SetValue(ForegroundProperty, value); set => SetValue(ForegroundProperty, value);
} }
public static readonly StyledProperty<bool> UseGraphColorProperty =
AvaloniaProperty.Register<CommitRefsPresenter, bool>(nameof(UseGraphColor), false);
public bool UseGraphColor
{
get => GetValue(UseGraphColorProperty);
set => SetValue(UseGraphColorProperty, value);
}
public static readonly StyledProperty<IBrush> TagBackgroundProperty = public static readonly StyledProperty<IBrush> TagBackgroundProperty =
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(TagBackground), Brushes.White); AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(TagBackground), Brushes.White);
@ -122,6 +131,7 @@ namespace SourceGit.Views
var typeface = new Typeface(FontFamily); var typeface = new Typeface(FontFamily);
var typefaceBold = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold); var typefaceBold = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold);
var fg = Foreground; var fg = Foreground;
var normalBG = UseGraphColor ? commit.Brush : Brushes.Gray;
var tagBG = TagBackground; var tagBG = TagBackground;
var labelSize = FontSize; var labelSize = FontSize;
var requiredWidth = 0.0; var requiredWidth = 0.0;
@ -139,7 +149,13 @@ namespace SourceGit.Views
isHead ? labelSize + 1 : labelSize, isHead ? labelSize + 1 : labelSize,
fg); fg);
var item = new RenderItem() { Label = label, Brush = commit.Brush, IsHead = isHead }; var item = new RenderItem()
{
Label = label,
Brush = normalBG,
IsHead = isHead
};
StreamGeometry geo; StreamGeometry geo;
switch (decorator.Type) switch (decorator.Type)
{ {

View file

@ -142,7 +142,8 @@
Foreground="{DynamicResource Brush.FG1}" Foreground="{DynamicResource Brush.FG1}"
FontFamily="{DynamicResource Fonts.Primary}" FontFamily="{DynamicResource Fonts.Primary}"
FontSize="11" FontSize="11"
VerticalAlignment="Center"/> VerticalAlignment="Center"
UseGraphColor="True"/>
<v:CommitSubjectPresenter Grid.Column="2" <v:CommitSubjectPresenter Grid.Column="2"
Classes="primary" Classes="primary"