Anvil
Anvil.API.Color Struct Reference

A 8 bit Color structure. More...

+ Inheritance diagram for Anvil.API.Color:
+ Collaboration diagram for Anvil.API.Color:

Public Member Functions

 Color (byte red, byte green, byte blue, byte alpha=255)
 Constructs a new Color from the given rgba values. More...
 
 Color (float red, float green, float blue, float alpha=1.0f)
 Constructs a new Color from the given rgba values. More...
 
bool Equals (Color other)
 
override bool Equals (object? obj)
 
override int GetHashCode ()
 
string ToColorToken ()
 Returns the 3 character sequence token for this color, used in coloring text.
This is mostly for internal use. Use StringExtensions.ColorString for formatting text with a certain color. More...
 
int ToRGBA ()
 Gets the 32-bit RGBA value of this Color structure. More...
 
override string ToString ()
 
uint ToUnsignedRGBA ()
 Gets the unsigned 32-bit RGBA value of this Color structure. More...
 

Static Public Member Functions

static unsafe Color FromRGBA (int rgba)
 Creates a Color structure from a 32-bit RGBA value. More...
 
static Color FromRGBA (string rgbaHexString)
 Creates a Color structure from a 32-bit RGBA hex string. More...
 
static unsafe Color FromRGBA (uint rgba)
 Creates a Color structure from an unsigned 32-bit RGBA value. More...
 
static bool operator!= (Color left, Color right)
 
static bool operator== (Color left, Color right)
 

Public Attributes

readonly byte Alpha
 Gets the alpha value of this color as a byte (0-255). More...
 
readonly byte Blue
 Gets the blue value of this color as a byte (0-255). More...
 
readonly byte Green
 Gets the green value of this color as a byte (0-255). More...
 
readonly byte Red
 Gets the red value of this color as a byte (0-255). More...
 

Properties

float AlphaF [get]
 Gets the alpha value of this color as a float (0-1). More...
 
float BlueF [get]
 Gets the blue value of this color as a float (0-1). More...
 
float GreenF [get]
 Gets the green value of this color as a float (0-1). More...
 
float RedF [get]
 Gets the red value of this color as a float (0-1). More...
 

Detailed Description

A 8 bit Color structure.

Constructor & Destructor Documentation

◆ Color() [1/2]

Anvil.API.Color.Color ( byte  red,
byte  green,
byte  blue,
byte  alpha = 255 
)
inline

Constructs a new Color from the given rgba values.

Parameters
redThe red value.
greenThe green value.
blueThe blue value.
alphaThe alpha value.

◆ Color() [2/2]

Anvil.API.Color.Color ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)
inline

Constructs a new Color from the given rgba values.

Parameters
redThe red value.
greenThe green value.
blueThe blue value.
alphaThe alpha value.

Member Function Documentation

◆ FromRGBA() [1/3]

static unsafe Color Anvil.API.Color.FromRGBA ( int  rgba)
inlinestatic

Creates a Color structure from a 32-bit RGBA value.

Parameters
rgbaThe 32-bit RGBA value.
Returns
A Color structure representing the RGBA value.

◆ FromRGBA() [2/3]

static Color Anvil.API.Color.FromRGBA ( string  rgbaHexString)
inlinestatic

Creates a Color structure from a 32-bit RGBA hex string.

Parameters
rgbaHexStringThe 32-bit RGBA hex string.
Returns
A Color structure representing the RGBA value.

◆ FromRGBA() [3/3]

static unsafe Color Anvil.API.Color.FromRGBA ( uint  rgba)
inlinestatic

Creates a Color structure from an unsigned 32-bit RGBA value.

Parameters
rgbaThe 32-bit RGBA value.
Returns
A Color structure representing the RGBA value.

◆ ToColorToken()

string Anvil.API.Color.ToColorToken ( )
inline

Returns the 3 character sequence token for this color, used in coloring text.
This is mostly for internal use. Use StringExtensions.ColorString for formatting text with a certain color.

Returns
The 3 character sequence token representing this color.

◆ ToRGBA()

int Anvil.API.Color.ToRGBA ( )
inline

Gets the 32-bit RGBA value of this Color structure.

Returns
The 32-bit RGBA value of this Color.

◆ ToUnsignedRGBA()

uint Anvil.API.Color.ToUnsignedRGBA ( )
inline

Gets the unsigned 32-bit RGBA value of this Color structure.

Returns
The 32-bit RGBA value of this Color.

Member Data Documentation

◆ Alpha

readonly byte Anvil.API.Color.Alpha

Gets the alpha value of this color as a byte (0-255).

◆ Blue

readonly byte Anvil.API.Color.Blue

Gets the blue value of this color as a byte (0-255).

◆ Green

readonly byte Anvil.API.Color.Green

Gets the green value of this color as a byte (0-255).

◆ Red

readonly byte Anvil.API.Color.Red

Gets the red value of this color as a byte (0-255).

Property Documentation

◆ AlphaF

float Anvil.API.Color.AlphaF
get

Gets the alpha value of this color as a float (0-1).

◆ BlueF

float Anvil.API.Color.BlueF
get

Gets the blue value of this color as a float (0-1).

◆ GreenF

float Anvil.API.Color.GreenF
get

Gets the green value of this color as a float (0-1).

◆ RedF

float Anvil.API.Color.RedF
get

Gets the red value of this color as a float (0-1).


The documentation for this struct was generated from the following file: