< Summary

Information
Class: Gravitas.Diagnostics.GravitasDiagnosticColor
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Diagnostics/DebugDraw/GravitasDiagnosticColor.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 60
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_Rgba()100%11100%
get_White()100%11100%
get_Red()100%11100%
get_Green()100%11100%
get_Blue()100%11100%
get_Yellow()100%11100%
get_Cyan()100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Diagnostics/DebugDraw/GravitasDiagnosticColor.cs

#LineLine coverage
 1//=======================================================================
 2// GravitasDiagnosticColor.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8namespace Gravitas.Diagnostics;
 9
 10/// <summary>
 11/// Engine-agnostic 8-bit RGBA color for diagnostic draw commands.
 12/// </summary>
 13public readonly struct GravitasDiagnosticColor
 14{
 15    /// <summary>Creates a color from red, green, blue, and alpha components.</summary>
 16    public GravitasDiagnosticColor(byte r, byte g, byte b, byte a = byte.MaxValue)
 17    {
 14918        R = r;
 14919        G = g;
 14920        B = b;
 14921        A = a;
 14922    }
 23
 24    /// <summary>Gets the red component.</summary>
 25    public byte R { get; }
 26
 27    /// <summary>Gets the green component.</summary>
 28    public byte G { get; }
 29
 30    /// <summary>Gets the blue component.</summary>
 31    public byte B { get; }
 32
 33    /// <summary>Gets the alpha component.</summary>
 34    public byte A { get; }
 35
 36    /// <summary>Gets the packed RGBA value with red in the most significant byte.</summary>
 37    public uint Rgba =>
 738        ((uint)R << 24)
 739        | ((uint)G << 16)
 740        | ((uint)B << 8)
 741        | A;
 42
 43    /// <summary>Gets opaque white.</summary>
 444    public static GravitasDiagnosticColor White => new(byte.MaxValue, byte.MaxValue, byte.MaxValue);
 45
 46    /// <summary>Gets opaque red.</summary>
 547    public static GravitasDiagnosticColor Red => new(byte.MaxValue, 0, 0);
 48
 49    /// <summary>Gets opaque green.</summary>
 950    public static GravitasDiagnosticColor Green => new(0, byte.MaxValue, 0);
 51
 52    /// <summary>Gets opaque blue.</summary>
 653    public static GravitasDiagnosticColor Blue => new(0, 0, byte.MaxValue);
 54
 55    /// <summary>Gets opaque yellow.</summary>
 856    public static GravitasDiagnosticColor Yellow => new(byte.MaxValue, byte.MaxValue, 0);
 57
 58    /// <summary>Gets opaque cyan.</summary>
 11559    public static GravitasDiagnosticColor Cyan => new(0, byte.MaxValue, byte.MaxValue);
 60}