< Summary

Information
Class: Allyaria.Theming.BrandTypes.BrandPalette
Assembly: Allyaria.Theming
File(s): /home/runner/work/allyaria/allyaria/src/Allyaria.Theming/BrandTypes/BrandPalette.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 48
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_AccentColor()100%11100%
get_BackgroundColor()100%11100%
get_BorderColor()100%11100%
get_CaretColor()100%11100%
get_ForegroundColor()100%11100%
get_OutlineColor()100%11100%
get_TextDecorationColor()100%11100%

File(s)

/home/runner/work/allyaria/allyaria/src/Allyaria.Theming/BrandTypes/BrandPalette.cs

#LineLine coverage
 1namespace Allyaria.Theming.BrandTypes;
 2
 3/// <summary>
 4/// Represents a complete color palette for a brand theme, including background, foreground, accent, border, and decorat
 5/// colors derived from a base background color.
 6/// </summary>
 7public sealed record BrandPalette
 8{
 9    /// <summary>
 10    /// Initializes a new instance of the <see cref="BrandPalette" /> struct using the specified background color.
 11    /// </summary>
 12    /// <param name="color">The base background <see cref="HexColor" /> from which all related palette colors are derive
 5642313    public BrandPalette(HexColor color)
 14    {
 5642315        var backgroundColor = color.SetAlpha(alpha: 255);
 16
 5642317        BackgroundColor = backgroundColor;
 5642318        ForegroundColor = BackgroundColor.ToForeground().EnsureContrast(background: BackgroundColor);
 5642319        CaretColor = ForegroundColor;
 5642320        AccentColor = ForegroundColor.ToAccent().EnsureContrast(background: BackgroundColor);
 5642321        BorderColor = BackgroundColor.ToAccent().EnsureContrast(background: BackgroundColor);
 5642322        OutlineColor = AccentColor;
 5642323        TextDecorationColor = AccentColor;
 5642324    }
 25
 26    /// <summary>Gets the accent color used for highlights or emphasized elements.</summary>
 11359127    public HexColor AccentColor { get; }
 28
 29    /// <summary>Gets the base background color of the palette.</summary>
 28266830    public HexColor BackgroundColor { get; }
 31
 32    /// <summary>Gets the border color, typically derived from the background’s accent tone.</summary>
 74333    public HexColor BorderColor { get; }
 34
 35    /// <summary>Gets the caret color used for text input cursors, matching the foreground for consistency.</summary>
 74336    public HexColor CaretColor { get; }
 37
 38    /// <summary>Gets the primary foreground color that provides sufficient contrast against the background.</summary>
 11622639    public HexColor ForegroundColor { get; }
 40
 41    /// <summary>
 42    /// Gets the outline color, typically aligned with the accent color for accessibility focus indicators.
 43    /// </summary>
 103744    public HexColor OutlineColor { get; }
 45
 46    /// <summary>Gets the text decoration color (e.g., underline) used for links and emphasized text.</summary>
 74347    public HexColor TextDecorationColor { get; }
 48}