Color
namespace Griff;
public struct ColorAn RGBA color with 0–1 float channels. Saved as hex, e.g. “#F08C2EFF”.
Properties
Section titled “Properties”public float A { get; init; }public byte AByte { get; }public float B { get; init; }public byte BByte { get; }public static Color Black { get; }public static Color Blue { get; }public static Color Cyan { get; }public float G { get; init; }public byte GByte { get; }public static Color Gray { get; }public static Color Green { get; }Magenta
Section titled “Magenta”public static Color Magenta { get; }Orange
Section titled “Orange”public static Color Orange { get; }public float R { get; init; }public byte RByte { get; }public static Color Red { get; }Transparent
Section titled “Transparent”public static Color Transparent { get; }public static Color White { get; }Yellow
Section titled “Yellow”public static Color Yellow { get; }Methods
Section titled “Methods”Deconstruct
Section titled “Deconstruct”public void Deconstruct(out float R, out float G, out float B, out float A)Equals
Section titled “Equals”public override bool Equals(object obj)Equals
Section titled “Equals”public bool Equals(Color other)FromBytes
Section titled “FromBytes”public static Color FromBytes(byte r, byte g, byte b, byte a = 255)FromHsv
Section titled “FromHsv”public static Color FromHsv(float hue, float saturation, float value, float alpha = 1f)The color with hue hue (degrees round the color wheel: 0 red, 120 green, 240 blue), saturation saturation (0 gray to 1 full) and value value (0 black to 1 bright).
GetHashCode
Section titled “GetHashCode”public override int GetHashCode()public static Color Lerp(Color a, Color b, float t)The color t of the way from a to b (0 gives a, 1 gives b).
public string ToHex()public ValueTuple<float, float, float> ToHsv()The color’s hue (0 to 360 degrees, 0 for grays), saturation and value (each 0 to 1); see FromHsv.
ToString
Section titled “ToString”public override string ToString()TryParse
Section titled “TryParse”public static bool TryParse(string? text, out Color color)Parses “#RGB”, “#RRGGBB” or “#RRGGBBAA” (the # is optional).