mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 13:14:59 +00:00
ux: use different inline code background for different themes
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
91acf0a32a
commit
d2e688908c
3 changed files with 18 additions and 1 deletions
|
@ -47,6 +47,15 @@ namespace SourceGit.Views
|
|||
get => GetValue(FontWeightProperty);
|
||||
set => SetValue(FontWeightProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<IBrush> InlineCodeBackgroundProperty =
|
||||
AvaloniaProperty.Register<CommitSubjectPresenter, IBrush>(nameof(InlineCodeBackground), Brushes.Transparent);
|
||||
|
||||
public IBrush InlineCodeBackground
|
||||
{
|
||||
get => GetValue(InlineCodeBackgroundProperty);
|
||||
set => SetValue(InlineCodeBackgroundProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<IBrush> ForegroundProperty =
|
||||
AvaloniaProperty.Register<CommitSubjectPresenter, IBrush>(nameof(Foreground), Brushes.White);
|
||||
|
@ -106,7 +115,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
var rect = new Rect(inline.X, (height - inline.Text.Height - 2) * 0.5, inline.Text.WidthIncludingTrailingWhitespace + 8, inline.Text.Height + 2);
|
||||
var roundedRect = new RoundedRect(rect, new CornerRadius(4));
|
||||
context.DrawRectangle(new SolidColorBrush(new Color(52, 101, 108, 118)), null, roundedRect);
|
||||
context.DrawRectangle(InlineCodeBackground, null, roundedRect);
|
||||
context.DrawText(inline.Text, new Point(inline.X + 4, (height - inline.Text.Height) * 0.5));
|
||||
}
|
||||
else
|
||||
|
@ -182,6 +191,10 @@ namespace SourceGit.Views
|
|||
_needRebuildInlines = true;
|
||||
InvalidateVisual();
|
||||
}
|
||||
else if (change.Property == InlineCodeBackgroundProperty)
|
||||
{
|
||||
InvalidateVisual();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPointerMoved(PointerEventArgs e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue