Table of Contents

Struct Color4

Namespace
Lime
Assembly
Lime.dll

Representation of 4-byte color (RGBA).

public struct Color4 : IEquatable<Color4>
Implements
Inherited Members

Constructors

Color4(byte, byte, byte, byte)

public Color4(byte r, byte g, byte b, byte a = 255)

Parameters

r byte
g byte
b byte
a byte

Color4(uint)

public Color4(uint abgr)

Parameters

abgr uint

Fields

A

public byte A

Field Value

byte

ABGR

[YuzuMember("0")]
public uint ABGR

Field Value

uint

B

public byte B

Field Value

byte

Black

public static readonly Color4 Black

Field Value

Color4

Blue

public static readonly Color4 Blue

Field Value

Color4

DarkGray

public static readonly Color4 DarkGray

Field Value

Color4

G

public byte G

Field Value

byte

Gray

public static readonly Color4 Gray

Field Value

Color4

Green

public static readonly Color4 Green

Field Value

Color4

Orange

public static readonly Color4 Orange

Field Value

Color4

R

public byte R

Field Value

byte

Red

public static readonly Color4 Red

Field Value

Color4

Transparent

public static readonly Color4 Transparent

Field Value

Color4

White

public static readonly Color4 White

Field Value

Color4

Yellow

public static readonly Color4 Yellow

Field Value

Color4

Zero

public static readonly Color4 Zero

Field Value

Color4

Methods

CreateArgb(byte, byte, byte, byte)

Creates an ARGB color-int from a specified alpha, red, green and blue components.

public static int CreateArgb(byte alpha, byte red, byte green, byte blue)

Parameters

alpha byte

Alpha component of the color.

red byte

Red component of the color.

green byte

Green component of the color.

blue byte

Blue component of the color.

Returns

int

ARGB color-int.

Darken(float)

Darken the color with the specified amount. Amount 1 turns the color into black, Amount 0 remains the color unchanged.

public Color4 Darken(float amount)

Parameters

amount float

Returns

Color4

Equals(Color4)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Color4 other)

Parameters

other Color4

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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.

FromFloats(float, float, float, float)

public static Color4 FromFloats(float r, float g, float b, float a = 1)

Parameters

r float
g float
b float
a float

Returns

Color4

GetAlphaComponent(int)

Gets the alpha component from a specified ARGB color-int.

public static byte GetAlphaComponent(int color)

Parameters

color int

The color as integer value in ARGB format.

Returns

byte

Alpha.

GetBlueComponent(int)

Gets the blue component from a specified ARGB color-int.

public static byte GetBlueComponent(int color)

Parameters

color int

The color as integer value in ARGB format.

Returns

byte

Blue.

GetGreenComponent(int)

Gets the green component from a specified ARGB color-int.

public static byte GetGreenComponent(int color)

Parameters

color int

The color as integer value in ARGB format.

Returns

byte

Green.

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.

GetRedComponent(int)

Gets the red component from a specified ARGB color-int.

public static byte GetRedComponent(int color)

Parameters

color int

The color as integer value in ARGB format.

Returns

byte

Red.

Lerp(float, Color4, Color4)

Creates a new Color4 that contains linear interpolation of the specified colors.

public static Color4 Lerp(float amount, Color4 value1, Color4 value2)

Parameters

amount float

Weighting value(between 0.0 and 1.0).

value1 Color4

The first color.

value2 Color4

The second color.

Returns

Color4

Lighten(float)

Lighten the color with the specified amount. Amount 1 turns the color into white, Amount 0 remains the color unchanged.

public Color4 Lighten(float amount)

Parameters

amount float

Returns

Color4

Parse(string)

public static Color4 Parse(string s)

Parameters

s string

Returns

Color4

PremulAlpha(Color4)

Multiplies every component of color with its alpha.

public static Color4 PremulAlpha(Color4 color)

Parameters

color Color4

Returns

Color4

RGB(uint)

public static Color4 RGB(uint rgb)

Parameters

rgb uint

Returns

Color4

RGBA(uint)

public static Color4 RGBA(uint rgba)

Parameters

rgba uint

Returns

Color4

ToString()

Returns the string representation of this Color4 in the format: "#R.G.B.A", where R, G, B, A are represented by hexadecimal numbers.

public override string ToString()

Returns

string

ToString(StringPresentation)

public string ToString(Color4.StringPresentation presentation)

Parameters

presentation Color4.StringPresentation

Returns

string

ToVector4()

public Vector4 ToVector4()

Returns

Vector4

Transparentify(float)

Change the color transparency with the specified amount. Amount 1 turns the color into fully transparent, Amount 0 remains the color unchanged.

public Color4 Transparentify(float amount)

Parameters

amount float

Returns

Color4

TryParse(string, out Color4)

public static bool TryParse(string s, out Color4 result)

Parameters

s string
result Color4

Returns

bool

Operators

operator ==(Color4, Color4)

public static bool operator ==(Color4 lhs, Color4 rhs)

Parameters

lhs Color4
rhs Color4

Returns

bool

operator !=(Color4, Color4)

public static bool operator !=(Color4 lhs, Color4 rhs)

Parameters

lhs Color4
rhs Color4

Returns

bool

operator *(Color4, Color4)

Component-wise multiplication of two colors.

public static Color4 operator *(Color4 lhs, Color4 rhs)

Parameters

lhs Color4
rhs Color4

Returns

Color4