Table of Contents

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

PackedValue uint

Color32(byte, byte, byte)

Initializes a new color from RGB byte components with full opacity.

public Color32(byte r, byte g, byte b)

Parameters

r byte

Red component (0-255).

g byte

Green component (0-255).

b byte

Blue component (0-255).

Color32(byte, byte, byte, byte)

Initializes a new color from RGBA byte components.

public Color32(byte r, byte g, byte b, byte a)

Parameters

r byte

Red component (0-255).

g byte

Green component (0-255).

b byte

Blue component (0-255).

a byte

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

r float

Red component (0.0-1.0).

g float

Green component (0.0-1.0).

b float

Blue component (0.0-1.0).

a float

Alpha component (0.0-1.0).

Fields

Black

Black color (0, 0, 0, 255).

public static readonly Color32 Black

Field Value

Color32

Blue

Blue color (0, 0, 255, 255).

public static readonly Color32 Blue

Field Value

Color32

Green

Green color (0, 255, 0, 255).

public static readonly Color32 Green

Field Value

Color32

Red

Red color (255, 0, 0, 255).

public static readonly Color32 Red

Field Value

Color32

White

White color (255, 255, 255, 255).

public static readonly Color32 White

Field Value

Color32

Yellow

Yellow color (255, 255, 0, 255).

public static readonly Color32 Yellow

Field Value

Color32

Properties

A

Gets or sets the alpha component (0-255).

public byte A { readonly get; set; }

Property Value

byte

B

Gets or sets the blue component (0-255).

public byte B { readonly get; set; }

Property Value

byte

G

Gets or sets the green component (0-255).

public byte G { readonly get; set; }

Property Value

byte

HexCode

Gets the color as an 8-character hex string in #RRGGBBAA format.

public readonly string HexCode { get; }

Property Value

string

PackedValue

public uint PackedValue { readonly get; set; }

Property Value

uint

R

Gets or sets the red component (0-255).

public byte R { readonly get; set; }

Property Value

byte

Methods

FromVector4(Vector4)

Creates a color from a System.Numerics.Vector4 where XYZW maps to RGBA.

public static Color32 FromVector4(Vector4 vector)

Parameters

vector Vector4

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()

Returns

Vector4