API reference
Struct Color
Namespace: MicroEngine
Assembly: MicroEngine.Kernel.dll
Guide: Graphics
An 8-bit-per-channel, non-premultiplied RGBA color.
public readonly struct Color : IEquatable<Color>Implements
Constructors
Color(byte, byte, byte, byte)
An 8-bit-per-channel, non-premultiplied RGBA color.
public Color(byte R, byte G, byte B, byte A = 255)Parameters
R byte
Red, 0..255.
G byte
Green, 0..255.
B byte
Blue, 0..255.
A byte
Opacity, 0 (transparent) to 255 (opaque, the default).
Fields
Black
Opaque black.
public static readonly Color BlackField Value
Transparent
Fully transparent black (0, 0, 0, 0).
public static readonly Color TransparentField Value
White
Opaque white. As a tint it leaves a texture unchanged.
public static readonly Color WhiteField Value
Properties
A
Opacity, 0 (transparent) to 255 (opaque, the default).
public byte A { get; init; }Property Value
B
Blue, 0..255.
public byte B { get; init; }Property Value
G
Green, 0..255.
public byte G { get; init; }Property Value
R
Red, 0..255.
public byte R { get; init; }Property Value
Methods
Deconstruct(out byte, out byte, out byte, out byte)
public void Deconstruct(out byte R, out byte G, out byte B, out byte A)Parameters
R byte
G byte
B byte
A byte
Equals(object)
public override bool Equals(object obj)Parameters
obj object
Returns
Equals(Color)
public bool Equals(Color other)Parameters
other Color
Returns
GetHashCode()
public override int GetHashCode()Returns
Hex(string)
Parses “#RRGGBB” or “#RRGGBBAA” (the leading ‘#’ is optional).
public static Color Hex(string hex)Parameters
hex string
Returns
Lerp(Color, Color, float)
Linear interpolation of every channel.
public static Color Lerp(Color a, Color b, float t)Parameters
a Color
b Color
t float
Returns
Shade(float)
Multiplies RGB by factor; values above 1 brighten.
public Color Shade(float factor)Parameters
factor float
Returns
ToString()
The colour as “#RRGGBBAA”, readable by Hex.
public override string ToString()Returns
WithAlpha(byte)
The same colour with opacity alpha (0..255).
public Color WithAlpha(byte alpha)Parameters
alpha byte
Returns
WithAlpha(float)
The same colour with opacity alpha given as 0..1 (clamped; fractions of a step are truncated).
public Color WithAlpha(float alpha)Parameters
alpha float
Returns
Operators
operator ==(Color, Color)
public static bool operator ==(Color left, Color right)Parameters
left Color
right Color
Returns
operator !=(Color, Color)
public static bool operator !=(Color left, Color right)Parameters
left Color
right Color