Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit ed75ca2

Browse files
committed
Expose the glyph background color as a dynamic resource
Rather than setting the glyph background color directly, expose it as a dynamic resource with the key `DiffChangeBackground`.
1 parent 2ad7b46 commit ed75ca2

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

src/GitHub.InlineReviews/Tags/AddInlineCommentGlyph.xaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
mc:Ignorable="d">
7-
<Viewbox x:Name="AddViewbox">
8-
<Path Stroke="Black"
7+
<UserControl.Resources>
8+
<SolidColorBrush x:Key="DiffChangeBackground" Color="DarkSlateGray" />
9+
</UserControl.Resources>
10+
11+
<Grid Background="{DynamicResource DiffChangeBackground}">
12+
<Viewbox x:Name="AddViewbox">
13+
<Path Stroke="Black"
914
Data="M13 2H1c-0.55 0-1 0.45-1 1v8c0 0.55 0.45 1 1 1h2v3.5l3.5-3.5h6.5c0.55 0 1-0.45 1-1V3c0-0.55-0.45-1-1-1z m0 9H6L4 13V11H1V3h12v8z M7,5 L7,9 M5,7 L9,7"/>
10-
</Viewbox>
15+
</Viewbox>
16+
</Grid>
1117
</UserControl>

src/GitHub.InlineReviews/Tags/InlineCommentGlyphFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public UIElement GenerateGlyph(IWpfTextViewLine line, InlineCommentTag tag)
7676
if (OpenThreadView(tag)) e.Handled = true;
7777
};
7878

79-
glyph.Background = brushesManager.GetBackground(tag.DiffChangeType);
79+
glyph.Resources["DiffChangeBackground"] = brushesManager.GetBackground(tag.DiffChangeType);
8080
return glyph;
8181
}
8282

src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
mc:Ignorable="d"
77
ToolTipService.ShowDuration="600000" ToolTipService.HasDropShadow="True">
8+
9+
<UserControl.Resources>
10+
<!-- This will be the color of an added/deleted word in the diff view or the indicator margin color -->
11+
<SolidColorBrush x:Key="DiffChangeBackground" Color="DarkSlateGray" />
12+
</UserControl.Resources>
13+
814
<UserControl.ToolTip>
915
<ToolTip x:Name="CommentToolTip" />
1016
</UserControl.ToolTip>
11-
<Viewbox>
12-
<Path Stroke="Black"
17+
18+
<Grid Background="{DynamicResource DiffChangeBackground}">
19+
<Viewbox>
20+
<Path Stroke="Black"
1321
Data="M13 2H1c-0.55 0-1 0.45-1 1v8c0 0.55 0.45 1 1 1h2v3.5l3.5-3.5h6.5c0.55 0 1-0.45 1-1V3c0-0.55-0.45-1-1-1z m0 9H6L4 13V11H1V3h12v8z"/>
14-
</Viewbox>
22+
</Viewbox>
23+
</Grid>
1524
</UserControl>

0 commit comments

Comments
 (0)