Table of Contents

Struct Color

Namespace
Termule.Engine.Types
Assembly
Termule.Engine.dll

Color that can be rendered by terminals. Wraps a FullColor or BasicColor.

public readonly struct Color
Inherited Members

Constructors

Color(float, float, float)

Initializes a new instance of the Color struct.

public Color(float r, float g, float b)

Parameters

r float

The FullColor red component.

g float

The FullColor green component.

b float

The FullColor blue component.

Color(BasicColor)

Initializes a new instance of the Color struct.

public Color(BasicColor baseColor)

Parameters

baseColor BasicColor

The base color to wrap.

Color(FullColor)

Initializes a new instance of the Color struct.

public Color(FullColor fullColor)

Parameters

fullColor FullColor

The full color to wrap.

Properties

Basic

Gets the basic preset color if one was set.

public BasicColor Basic { get; }

Property Value

BasicColor

Full

Gets the full RGB color if one was set.

public FullColor? Full { get; }

Property Value

FullColor?

Methods

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Operators

operator ==(Color, Color)

Determines whether two Color instances are equal.

public static bool operator ==(Color c1, Color c2)

Parameters

c1 Color

The first Color to compare.

c2 Color

The second Color to compare.

Returns

bool

true if the colors are equal; otherwise, false.

implicit operator Color((float r, float g, float b))

Creates a Color from a tuple representing a FullColor.

public static implicit operator Color((float r, float g, float b) tuple)

Parameters

tuple (float r, float g, float b)

The RGB tuple to use.

Returns

Color

implicit operator Color(BasicColor)

Creates a color from a basic color.

public static implicit operator Color(BasicColor b)

Parameters

b BasicColor

The basic color to use.

Returns

Color

implicit operator Color(FullColor)

Creates a Color from a FullColor.

public static implicit operator Color(FullColor fullColor)

Parameters

fullColor FullColor

The FullColor to use.

Returns

Color

operator !=(Color, Color)

Determines whether two Color instances are not equal.

public static bool operator !=(Color c1, Color c2)

Parameters

c1 Color

The first Color to compare.

c2 Color

The second Color to compare.

Returns

bool

true if the colors are not equal; otherwise, false.