logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct ColorRGBA

    Engine-agnostic color representation with RGBA components. All components are in the range 0-1. Immutable value object that supports equality comparison and linear interpolation.

    Implements
    IEquatable<ColorRGBA>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.ProceduralExpression.Domain.ValueObjects
    Assembly: Serenity.ProceduralExpression.Domain.dll
    Syntax
    public readonly struct ColorRGBA : IEquatable<ColorRGBA>

    Constructors

    ColorRGBA(float, float, float)

    Creates a new ColorRGBA with full opacity (alpha = 1).

    Declaration
    public ColorRGBA(float r, float g, float b)
    Parameters
    Type Name Description
    float r

    Red component (0-1).

    float g

    Green component (0-1).

    float b

    Blue component (0-1).

    ColorRGBA(float, float, float, float)

    Creates a new ColorRGBA with the specified components.

    Declaration
    public ColorRGBA(float r, float g, float b, float a)
    Parameters
    Type Name Description
    float r

    Red component (0-1).

    float g

    Green component (0-1).

    float b

    Blue component (0-1).

    float a

    Alpha component (0-1).

    Fields

    A

    Alpha component (0-1).

    Declaration
    public readonly float A
    Field Value
    Type Description
    float

    B

    Blue component (0-1).

    Declaration
    public readonly float B
    Field Value
    Type Description
    float

    G

    Green component (0-1).

    Declaration
    public readonly float G
    Field Value
    Type Description
    float

    R

    Red component (0-1).

    Declaration
    public readonly float R
    Field Value
    Type Description
    float

    Properties

    Black

    Predefined black color (0, 0, 0, 1).

    Declaration
    public static ColorRGBA Black { get; }
    Property Value
    Type Description
    ColorRGBA

    Blue

    Predefined blue color (0, 0, 1, 1).

    Declaration
    public static ColorRGBA Blue { get; }
    Property Value
    Type Description
    ColorRGBA

    Clear

    Predefined transparent color (0, 0, 0, 0).

    Declaration
    public static ColorRGBA Clear { get; }
    Property Value
    Type Description
    ColorRGBA

    Green

    Predefined green color (0, 1, 0, 1).

    Declaration
    public static ColorRGBA Green { get; }
    Property Value
    Type Description
    ColorRGBA

    Red

    Predefined red color (1, 0, 0, 1).

    Declaration
    public static ColorRGBA Red { get; }
    Property Value
    Type Description
    ColorRGBA

    White

    Predefined white color (1, 1, 1, 1).

    Declaration
    public static ColorRGBA White { get; }
    Property Value
    Type Description
    ColorRGBA

    Methods

    Equals(ColorRGBA)

    Declaration
    public bool Equals(ColorRGBA other)
    Parameters
    Type Name Description
    ColorRGBA other
    Returns
    Type Description
    bool

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    ValueType.Equals(object)

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    Lerp(ColorRGBA, ColorRGBA, float)

    Linearly interpolates between two colors (unclamped).

    Declaration
    public static ColorRGBA Lerp(ColorRGBA a, ColorRGBA b, float t)
    Parameters
    Type Name Description
    ColorRGBA a

    Start color.

    ColorRGBA b

    End color.

    float t

    Interpolation factor (0 = a, 1 = b, can be outside 0-1).

    Returns
    Type Description
    ColorRGBA

    Interpolated color.

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    ValueType.ToString()

    Operators

    operator ==(ColorRGBA, ColorRGBA)

    Declaration
    public static bool operator ==(ColorRGBA left, ColorRGBA right)
    Parameters
    Type Name Description
    ColorRGBA left
    ColorRGBA right
    Returns
    Type Description
    bool

    operator !=(ColorRGBA, ColorRGBA)

    Declaration
    public static bool operator !=(ColorRGBA left, ColorRGBA right)
    Parameters
    Type Name Description
    ColorRGBA left
    ColorRGBA right
    Returns
    Type Description
    bool

    Implements

    IEquatable<T>
    In this article
    © 2026 Serenity. All Rights Reserved