Struct Color32
- Namespace
- ValveResourceFormat.Renderer
- Assembly
- Renderer.dll
32-bit RGBA color with byte component storage.
public record struct Color32 : IEquatable<Color32>Implements
Inherited Members
Constructors
Color32(uint)
32-bit RGBA color with byte component storage.
public Color32(uint PackedValue)Parameters
PackedValueuint
Color32(byte, byte, byte)
Initializes a new color from RGB byte components with full opacity.
public Color32(byte r, byte g, byte b)Parameters
Color32(byte, byte, byte, byte)
Initializes a new color from RGBA byte components.
public Color32(byte r, byte g, byte b, byte a)Parameters
rbyte-
Red component (0-255).
gbyte-
Green component (0-255).
bbyte-
Blue component (0-255).
abyte-
Alpha component (0-255).
Color32(float, float, float, float)
Initializes a new color from RGBA float components.
public Color32(float r, float g, float b, float a)Parameters
rfloat-
Red component (0.0-1.0).
gfloat-
Green component (0.0-1.0).
bfloat-
Blue component (0.0-1.0).
afloat-
Alpha component (0.0-1.0).
Fields
Black
Black color (0, 0, 0, 255).
public static readonly Color32 BlackField Value
Blue
Blue color (0, 0, 255, 255).
public static readonly Color32 BlueField Value
Green
Green color (0, 255, 0, 255).
public static readonly Color32 GreenField Value
Red
Red color (255, 0, 0, 255).
public static readonly Color32 RedField Value
White
White color (255, 255, 255, 255).
public static readonly Color32 WhiteField Value
Yellow
Yellow color (255, 255, 0, 255).
public static readonly Color32 YellowField Value
Properties
A
Gets or sets the alpha component (0-255).
public byte A { readonly get; set; }Property Value
B
Gets or sets the blue component (0-255).
public byte B { readonly get; set; }Property Value
G
Gets or sets the green component (0-255).
public byte G { readonly get; set; }Property Value
HexCode
Gets the color as an 8-character hex string in #RRGGBBAA format.
public readonly string HexCode { get; }Property Value
PackedValue
public uint PackedValue { readonly get; set; }Property Value
R
Gets or sets the red component (0-255).
public byte R { readonly get; set; }Property Value
Methods
FromVector4(Vector4)
Creates a color from a System.Numerics.Vector4 where XYZW maps to RGBA.
public static Color32 FromVector4(Vector4 vector)Parameters
vectorVector4-
Vector with color components (0.0-1.0).
Returns
- Color32
-
The converted color.
ToLinearColor()
Converts this color to a linear color space System.Numerics.Vector4 with components in the range [0, 1].
public readonly Vector4 ToLinearColor()