From 6809eaf2bd09f6ebaac9d3de2e3545585b09c2e2 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 1 Dec 2025 14:16:06 +0800 Subject: [PATCH] enhance: different icons for annotated and lightweight tags (#1942) Signed-off-by: leo --- src/Views/TagsView.axaml | 24 +++++++++++++++++++++--- src/Views/TagsView.axaml.cs | 19 ++++++++++++++----- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/Views/TagsView.axaml b/src/Views/TagsView.axaml index 5ec914e6..7d79d04a 100644 --- a/src/Views/TagsView.axaml +++ b/src/Views/TagsView.axaml @@ -87,7 +87,17 @@ + Data="{StaticResource Icons.Tag}" + IsVisible="{Binding Tag.IsAnnotated}"/> + + - - + + + diff --git a/src/Views/TagsView.axaml.cs b/src/Views/TagsView.axaml.cs index 904dbaa6..d2275d04 100644 --- a/src/Views/TagsView.axaml.cs +++ b/src/Views/TagsView.axaml.cs @@ -63,19 +63,19 @@ namespace SourceGit.Views } if (node.Tag != null) - CreateContent(new Thickness(0, 0, 0, 0), "Icons.Tag"); + CreateContent(new Thickness(0, 0, 0, 0), "Icons.Tag", node.ToolTip is { IsAnnotated: false }); else if (node.IsExpanded) - CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder.Open"); + CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder.Open", false); else - CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder"); + CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder", false); } - private void CreateContent(Thickness margin, string iconKey) + private void CreateContent(Thickness margin, string iconKey, bool stroke) { if (this.FindResource(iconKey) is not StreamGeometry geo) return; - Content = new Avalonia.Controls.Shapes.Path() + var path = new Avalonia.Controls.Shapes.Path() { Width = 12, Height = 12, @@ -84,6 +84,15 @@ namespace SourceGit.Views Margin = margin, Data = geo, }; + + if (stroke) + { + path.Fill = Brushes.Transparent; + path.Stroke = this.FindResource("Brush.FG1") as IBrush; + path.StrokeThickness = 1; + } + + Content = path; } }