@@ -47,6 +47,15 @@ public FontWeight FontWeight
47
47
get => GetValue ( FontWeightProperty ) ;
48
48
set => SetValue ( FontWeightProperty , value ) ;
49
49
}
50
+
51
+ public static readonly StyledProperty < IBrush > InlineCodeBackgroundProperty =
52
+ AvaloniaProperty . Register < CommitSubjectPresenter , IBrush > ( nameof ( InlineCodeBackground ) , Brushes . Transparent ) ;
53
+
54
+ public IBrush InlineCodeBackground
55
+ {
56
+ get => GetValue ( InlineCodeBackgroundProperty ) ;
57
+ set => SetValue ( InlineCodeBackgroundProperty , value ) ;
58
+ }
50
59
51
60
public static readonly StyledProperty < IBrush > ForegroundProperty =
52
61
AvaloniaProperty . Register < CommitSubjectPresenter , IBrush > ( nameof ( Foreground ) , Brushes . White ) ;
@@ -106,7 +115,7 @@ public override void Render(DrawingContext context)
106
115
{
107
116
var rect = new Rect ( inline . X , ( height - inline . Text . Height - 2 ) * 0.5 , inline . Text . WidthIncludingTrailingWhitespace + 8 , inline . Text . Height + 2 ) ;
108
117
var roundedRect = new RoundedRect ( rect , new CornerRadius ( 4 ) ) ;
109
- context . DrawRectangle ( new SolidColorBrush ( new Color ( 52 , 101 , 108 , 118 ) ) , null , roundedRect ) ;
118
+ context . DrawRectangle ( InlineCodeBackground , null , roundedRect ) ;
110
119
context . DrawText ( inline . Text , new Point ( inline . X + 4 , ( height - inline . Text . Height ) * 0.5 ) ) ;
111
120
}
112
121
else
@@ -182,6 +191,10 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
182
191
_needRebuildInlines = true ;
183
192
InvalidateVisual ( ) ;
184
193
}
194
+ else if ( change . Property == InlineCodeBackgroundProperty )
195
+ {
196
+ InvalidateVisual ( ) ;
197
+ }
185
198
}
186
199
187
200
protected override void OnPointerMoved ( PointerEventArgs e )
0 commit comments