theme: add ThemeOverrides.OpacityForNotMergedCommits to customize the opacity of commits that not belongs (haven't been merged) to current branch in histories (#268)

This commit is contained in:
leo 2024-07-18 10:46:39 +08:00
parent b2ed1b283a
commit 14469b1399
No known key found for this signature in database
5 changed files with 22 additions and 16 deletions

View file

@ -2,11 +2,18 @@
using System.Collections.Generic;
using Avalonia;
using Avalonia.Media;
namespace SourceGit.Models
{
public class Commit
{
public static double OpacityForNotMerged
{
get;
set;
} = 0.5;
public string SHA { get; set; } = string.Empty;
public User Author { get; set; } = User.Invalid;
public ulong AuthorTime { get; set; } = 0;
@ -25,5 +32,8 @@ namespace SourceGit.Models
public bool IsCommitterVisible => !Author.Equals(Committer) || AuthorTime != CommitterTime;
public bool IsCurrentHead => Decorators.Find(x => x.Type is DecoratorType.CurrentBranchHead or DecoratorType.CurrentCommitHead) != null;
public double Opacity => IsMerged ? 1 : OpacityForNotMerged;
public FontWeight FontWeight => IsCurrentHead ? FontWeight.Bold : FontWeight.Regular;
}
}