Table of Contents

Struct Color

Namespace
Stride.Core.Mathematics
Assembly
Stride.Core.Mathematics.dll

Represents a 32-bit color (4 bytes) in the form of RGBA (in byte order: R, G, B, A).

[DataContract("Color")]
[DataStyle(DataStyle.Compact)]
public struct Color : IEquatable<Color>
Implements

Constructors

Color(Vector3)

Initializes a new instance of the Color struct. Alpha is set to 255.

public Color(Vector3 value)

Parameters

value Vector3

The red, green, and blue components of the color.

Color(Vector3, float)

Initializes a new instance of the Color struct.

public Color(Vector3 value, float alpha)

Parameters

value Vector3

The red, green, and blue components of the color.

alpha float

The alpha component of the color.

Color(Vector4)

Initializes a new instance of the Color struct.

public Color(Vector4 value)

Parameters

value Vector4

The red, green, blue, and alpha components of the color.

Color(byte)

Initializes a new instance of the Color struct.

public Color(byte value)

Parameters

value byte

The value that will be assigned to all components.

Color(byte, byte, byte)

Initializes a new instance of the Color struct. Alpha is set to 255.

public Color(byte red, byte green, byte blue)

Parameters

red byte

The red component of the color.

green byte

The green component of the color.

blue byte

The blue component of the color.

Color(byte, byte, byte, byte)

Initializes a new instance of the Color struct.

public Color(byte red, byte green, byte blue, byte alpha)

Parameters

red byte

The red component of the color.

green byte

The green component of the color.

blue byte

The blue component of the color.

alpha byte

The alpha component of the color.

Color(byte[])

Initializes a new instance of the Color struct.

public Color(byte[] values)

Parameters

values byte[]

The values to assign to the red, green, blue, or alpha components of the color. This must be an array with four elements.

Exceptions

ArgumentNullException

Thrown when values is null.

ArgumentOutOfRangeException

Thrown when values contains more or less than four elements.

Color(int)

Initializes a new instance of the Color struct.

public Color(int rgba)

Parameters

rgba int

A packed integer containing all four color components in RGBA order.

Color(float)

Initializes a new instance of the Color struct.

public Color(float value)

Parameters

value float

The value that will be assigned to all components.

Color(float, float, float)

Initializes a new instance of the Color struct. Alpha is set to 255.

public Color(float red, float green, float blue)

Parameters

red float

The red component of the color.

green float

The green component of the color.

blue float

The blue component of the color.

Color(float, float, float, float)

Initializes a new instance of the Color struct.

public Color(float red, float green, float blue, float alpha)

Parameters

red float

The red component of the color.

green float

The green component of the color.

blue float

The blue component of the color.

alpha float

The alpha component of the color.

Color(float[])

Initializes a new instance of the Color struct.

public Color(float[] values)

Parameters

values float[]

The values to assign to the red, green, and blue, alpha components of the color. This must be an array with four elements.

Exceptions

ArgumentNullException

Thrown when values is null.

ArgumentOutOfRangeException

Thrown when values contains more or less than four elements.

Color(uint)

Initializes a new instance of the Color struct.

public Color(uint rgba)

Parameters

rgba uint

A packed integer containing all four color components in RGBA order.

Fields

A

The alpha component of the color.

[DataMember(3)]
public byte A

Field Value

byte

AliceBlue

AliceBlue color.

public static readonly Color AliceBlue

Field Value

Color

AntiqueWhite

AntiqueWhite color.

public static readonly Color AntiqueWhite

Field Value

Color

Aqua

Aqua color.

public static readonly Color Aqua

Field Value

Color

Aquamarine

Aquamarine color.

public static readonly Color Aquamarine

Field Value

Color

Azure

Azure color.

public static readonly Color Azure

Field Value

Color

B

The blue component of the color.

[DataMember(2)]
public byte B

Field Value

byte

Beige

Beige color.

public static readonly Color Beige

Field Value

Color

Bisque

Bisque color.

public static readonly Color Bisque

Field Value

Color

Black

Black color.

public static readonly Color Black

Field Value

Color

BlanchedAlmond

BlanchedAlmond color.

public static readonly Color BlanchedAlmond

Field Value

Color

Blue

Blue color.

public static readonly Color Blue

Field Value

Color

BlueViolet

BlueViolet color.

public static readonly Color BlueViolet

Field Value

Color

Brown

Brown color.

public static readonly Color Brown

Field Value

Color

BurlyWood

BurlyWood color.

public static readonly Color BurlyWood

Field Value

Color

CadetBlue

CadetBlue color.

public static readonly Color CadetBlue

Field Value

Color

Chartreuse

Chartreuse color.

public static readonly Color Chartreuse

Field Value

Color

Chocolate

Chocolate color.

public static readonly Color Chocolate

Field Value

Color

Coral

Coral color.

public static readonly Color Coral

Field Value

Color

CornflowerBlue

CornflowerBlue color.

public static readonly Color CornflowerBlue

Field Value

Color

Cornsilk

Cornsilk color.

public static readonly Color Cornsilk

Field Value

Color

Crimson

Crimson color.

public static readonly Color Crimson

Field Value

Color

Cyan

Cyan color.

public static readonly Color Cyan

Field Value

Color

DarkBlue

DarkBlue color.

public static readonly Color DarkBlue

Field Value

Color

DarkCyan

DarkCyan color.

public static readonly Color DarkCyan

Field Value

Color

DarkGoldenrod

DarkGoldenrod color.

public static readonly Color DarkGoldenrod

Field Value

Color

DarkGray

DarkGray color.

public static readonly Color DarkGray

Field Value

Color

DarkGreen

DarkGreen color.

public static readonly Color DarkGreen

Field Value

Color

DarkKhaki

DarkKhaki color.

public static readonly Color DarkKhaki

Field Value

Color

DarkMagenta

DarkMagenta color.

public static readonly Color DarkMagenta

Field Value

Color

DarkOliveGreen

DarkOliveGreen color.

public static readonly Color DarkOliveGreen

Field Value

Color

DarkOrange

DarkOrange color.

public static readonly Color DarkOrange

Field Value

Color

DarkOrchid

DarkOrchid color.

public static readonly Color DarkOrchid

Field Value

Color

DarkRed

DarkRed color.

public static readonly Color DarkRed

Field Value

Color

DarkSalmon

DarkSalmon color.

public static readonly Color DarkSalmon

Field Value

Color

DarkSeaGreen

DarkSeaGreen color.

public static readonly Color DarkSeaGreen

Field Value

Color

DarkSlateBlue

DarkSlateBlue color.

public static readonly Color DarkSlateBlue

Field Value

Color

DarkSlateGray

DarkSlateGray color.

public static readonly Color DarkSlateGray

Field Value

Color

DarkTurquoise

DarkTurquoise color.

public static readonly Color DarkTurquoise

Field Value

Color

DarkViolet

DarkViolet color.

public static readonly Color DarkViolet

Field Value

Color

DeepPink

DeepPink color.

public static readonly Color DeepPink

Field Value

Color

DeepSkyBlue

DeepSkyBlue color.

public static readonly Color DeepSkyBlue

Field Value

Color

DimGray

DimGray color.

public static readonly Color DimGray

Field Value

Color

DodgerBlue

DodgerBlue color.

public static readonly Color DodgerBlue

Field Value

Color

Firebrick

Firebrick color.

public static readonly Color Firebrick

Field Value

Color

FloralWhite

FloralWhite color.

public static readonly Color FloralWhite

Field Value

Color

ForestGreen

ForestGreen color.

public static readonly Color ForestGreen

Field Value

Color

Fuchsia

Fuchsia color.

public static readonly Color Fuchsia

Field Value

Color

G

The green component of the color.

[DataMember(1)]
public byte G

Field Value

byte

Gainsboro

Gainsboro color.

public static readonly Color Gainsboro

Field Value

Color

GhostWhite

GhostWhite color.

public static readonly Color GhostWhite

Field Value

Color

Gold

Gold color.

public static readonly Color Gold

Field Value

Color

Goldenrod

Goldenrod color.

public static readonly Color Goldenrod

Field Value

Color

Gray

Gray color.

public static readonly Color Gray

Field Value

Color

Green

Green color.

public static readonly Color Green

Field Value

Color

GreenYellow

GreenYellow color.

public static readonly Color GreenYellow

Field Value

Color

Honeydew

Honeydew color.

public static readonly Color Honeydew

Field Value

Color

HotPink

HotPink color.

public static readonly Color HotPink

Field Value

Color

IndianRed

IndianRed color.

public static readonly Color IndianRed

Field Value

Color

Indigo

Indigo color.

public static readonly Color Indigo

Field Value

Color

Ivory

Ivory color.

public static readonly Color Ivory

Field Value

Color

Khaki

Khaki color.

public static readonly Color Khaki

Field Value

Color

Lavender

Lavender color.

public static readonly Color Lavender

Field Value

Color

LavenderBlush

LavenderBlush color.

public static readonly Color LavenderBlush

Field Value

Color

LawnGreen

LawnGreen color.

public static readonly Color LawnGreen

Field Value

Color

LemonChiffon

LemonChiffon color.

public static readonly Color LemonChiffon

Field Value

Color

LightBlue

LightBlue color.

public static readonly Color LightBlue

Field Value

Color

LightCoral

LightCoral color.

public static readonly Color LightCoral

Field Value

Color

LightCyan

LightCyan color.

public static readonly Color LightCyan

Field Value

Color

LightGoldenrodYellow

LightGoldenrodYellow color.

public static readonly Color LightGoldenrodYellow

Field Value

Color

LightGray

LightGray color.

public static readonly Color LightGray

Field Value

Color

LightGreen

LightGreen color.

public static readonly Color LightGreen

Field Value

Color

LightPink

LightPink color.

public static readonly Color LightPink

Field Value

Color

LightSalmon

LightSalmon color.

public static readonly Color LightSalmon

Field Value

Color

LightSeaGreen

LightSeaGreen color.

public static readonly Color LightSeaGreen

Field Value

Color

LightSkyBlue

LightSkyBlue color.

public static readonly Color LightSkyBlue

Field Value

Color

LightSlateGray

LightSlateGray color.

public static readonly Color LightSlateGray

Field Value

Color

LightSteelBlue

LightSteelBlue color.

public static readonly Color LightSteelBlue

Field Value

Color

LightYellow

LightYellow color.

public static readonly Color LightYellow

Field Value

Color

Lime

Lime color.

public static readonly Color Lime

Field Value

Color

LimeGreen

LimeGreen color.

public static readonly Color LimeGreen

Field Value

Color

Linen

Linen color.

public static readonly Color Linen

Field Value

Color

Magenta

Magenta color.

public static readonly Color Magenta

Field Value

Color

Maroon

Maroon color.

public static readonly Color Maroon

Field Value

Color

MediumAquamarine

MediumAquamarine color.

public static readonly Color MediumAquamarine

Field Value

Color

MediumBlue

MediumBlue color.

public static readonly Color MediumBlue

Field Value

Color

MediumOrchid

MediumOrchid color.

public static readonly Color MediumOrchid

Field Value

Color

MediumPurple

MediumPurple color.

public static readonly Color MediumPurple

Field Value

Color

MediumSeaGreen

MediumSeaGreen color.

public static readonly Color MediumSeaGreen

Field Value

Color

MediumSlateBlue

MediumSlateBlue color.

public static readonly Color MediumSlateBlue

Field Value

Color

MediumSpringGreen

MediumSpringGreen color.

public static readonly Color MediumSpringGreen

Field Value

Color

MediumTurquoise

MediumTurquoise color.

public static readonly Color MediumTurquoise

Field Value

Color

MediumVioletRed

MediumVioletRed color.

public static readonly Color MediumVioletRed

Field Value

Color

MidnightBlue

MidnightBlue color.

public static readonly Color MidnightBlue

Field Value

Color

MintCream

MintCream color.

public static readonly Color MintCream

Field Value

Color

MistyRose

MistyRose color.

public static readonly Color MistyRose

Field Value

Color

Moccasin

Moccasin color.

public static readonly Color Moccasin

Field Value

Color

NavajoWhite

NavajoWhite color.

public static readonly Color NavajoWhite

Field Value

Color

Navy

Navy color.

public static readonly Color Navy

Field Value

Color

OldLace

OldLace color.

public static readonly Color OldLace

Field Value

Color

Olive

Olive color.

public static readonly Color Olive

Field Value

Color

OliveDrab

OliveDrab color.

public static readonly Color OliveDrab

Field Value

Color

Orange

Orange color.

public static readonly Color Orange

Field Value

Color

OrangeRed

OrangeRed color.

public static readonly Color OrangeRed

Field Value

Color

Orchid

Orchid color.

public static readonly Color Orchid

Field Value

Color

PaleGoldenrod

PaleGoldenrod color.

public static readonly Color PaleGoldenrod

Field Value

Color

PaleGreen

PaleGreen color.

public static readonly Color PaleGreen

Field Value

Color

PaleTurquoise

PaleTurquoise color.

public static readonly Color PaleTurquoise

Field Value

Color

PaleVioletRed

PaleVioletRed color.

public static readonly Color PaleVioletRed

Field Value

Color

PapayaWhip

PapayaWhip color.

public static readonly Color PapayaWhip

Field Value

Color

PeachPuff

PeachPuff color.

public static readonly Color PeachPuff

Field Value

Color

Peru

Peru color.

public static readonly Color Peru

Field Value

Color

Pink

Pink color.

public static readonly Color Pink

Field Value

Color

Plum

Plum color.

public static readonly Color Plum

Field Value

Color

PowderBlue

PowderBlue color.

public static readonly Color PowderBlue

Field Value

Color

Purple

Purple color.

public static readonly Color Purple

Field Value

Color

R

The red component of the color.

[DataMember(0)]
public byte R

Field Value

byte

Red

Red color.

public static readonly Color Red

Field Value

Color

RosyBrown

RosyBrown color.

public static readonly Color RosyBrown

Field Value

Color

RoyalBlue

RoyalBlue color.

public static readonly Color RoyalBlue

Field Value

Color

SaddleBrown

SaddleBrown color.

public static readonly Color SaddleBrown

Field Value

Color

Salmon

Salmon color.

public static readonly Color Salmon

Field Value

Color

SandyBrown

SandyBrown color.

public static readonly Color SandyBrown

Field Value

Color

SeaGreen

SeaGreen color.

public static readonly Color SeaGreen

Field Value

Color

SeaShell

SeaShell color.

public static readonly Color SeaShell

Field Value

Color

Sienna

Sienna color.

public static readonly Color Sienna

Field Value

Color

Silver

Silver color.

public static readonly Color Silver

Field Value

Color

SkyBlue

SkyBlue color.

public static readonly Color SkyBlue

Field Value

Color

SlateBlue

SlateBlue color.

public static readonly Color SlateBlue

Field Value

Color

SlateGray

SlateGray color.

public static readonly Color SlateGray

Field Value

Color

Snow

Snow color.

public static readonly Color Snow

Field Value

Color

SpringGreen

SpringGreen color.

public static readonly Color SpringGreen

Field Value

Color

SteelBlue

SteelBlue color.

public static readonly Color SteelBlue

Field Value

Color

Tan

Tan color.

public static readonly Color Tan

Field Value

Color

Teal

Teal color.

public static readonly Color Teal

Field Value

Color

Thistle

Thistle color.

public static readonly Color Thistle

Field Value

Color

Tomato

Tomato color.

public static readonly Color Tomato

Field Value

Color

Transparent

Transparent color.

public static readonly Color Transparent

Field Value

Color

Turquoise

Turquoise color.

public static readonly Color Turquoise

Field Value

Color

VeryDimGray

VeryDimGray color.

public static readonly Color VeryDimGray

Field Value

Color

Violet

Violet color.

public static readonly Color Violet

Field Value

Color

Wheat

Wheat color.

public static readonly Color Wheat

Field Value

Color

White

White color.

public static readonly Color White

Field Value

Color

WhiteSmoke

WhiteSmoke color.

public static readonly Color WhiteSmoke

Field Value

Color

Yellow

Yellow color.

public static readonly Color Yellow

Field Value

Color

YellowGreen

YellowGreen color.

public static readonly Color YellowGreen

Field Value

Color

Zero

Zero color.

public static readonly Color Zero

Field Value

Color

Properties

this[int]

Gets or sets the component at the specified index.

public byte this[int index] { get; set; }

Parameters

index int

The index of the component to access. Use 0 for the red(R) component, 1 for the green(G) component, 2 for the blue(B) component, and 3 for the alpha(A) component.

Property Value

byte

The value of the red, green, blue, or alpha component, depending on the index.

Exceptions

ArgumentOutOfRangeException

Thrown when the index is out of the range [0, 3].

Methods

Add(Color, Color)

Adds two colors.

public static Color Add(Color left, Color right)

Parameters

left Color

The first color to add.

right Color

The second color to add.

Returns

Color

The sum of the two colors.

Add(ref readonly Color, ref readonly Color, out Color)

Adds two colors.

public static void Add(ref readonly Color left, ref readonly Color right, out Color result)

Parameters

left Color

The first color to add.

right Color

The second color to add.

result Color

When the method completes, completes the sum of the two colors.

AdjustContrast(Color, float)

Adjusts the contrast of a color.

public static Color AdjustContrast(Color value, float contrast)

Parameters

value Color

The color whose contrast is to be adjusted.

contrast float

The amount by which to adjust the contrast.

Returns

Color

The adjusted color.

AdjustContrast(ref readonly Color, float, out Color)

Adjusts the contrast of a color.

public static void AdjustContrast(ref readonly Color value, float contrast, out Color result)

Parameters

value Color

The color whose contrast is to be adjusted.

contrast float

The amount by which to adjust the contrast.

result Color

When the method completes, contains the adjusted color.

AdjustSaturation(Color, float)

Adjusts the saturation of a color.

public static Color AdjustSaturation(Color value, float saturation)

Parameters

value Color

The color whose saturation is to be adjusted.

saturation float

The amount by which to adjust the saturation.

Returns

Color

The adjusted color.

AdjustSaturation(ref readonly Color, float, out Color)

Adjusts the saturation of a color.

public static void AdjustSaturation(ref readonly Color value, float saturation, out Color result)

Parameters

value Color

The color whose saturation is to be adjusted.

saturation float

The amount by which to adjust the saturation.

result Color

When the method completes, contains the adjusted color.

Clamp(Color, Color, Color)

Restricts a value to be within a specified range.

public static Color Clamp(Color value, Color min, Color max)

Parameters

value Color

The value to clamp.

min Color

The minimum value.

max Color

The maximum value.

Returns

Color

The clamped value.

Clamp(ref readonly Color, ref readonly Color, ref readonly Color, out Color)

Restricts a value to be within a specified range.

public static void Clamp(ref readonly Color value, ref readonly Color min, ref readonly Color max, out Color result)

Parameters

value Color

The value to clamp.

min Color

The minimum value.

max Color

The maximum value.

result Color

When the method completes, contains the clamped value.

Equals(Color)

Determines whether the specified Color is equal to this instance.

public bool Equals(Color other)

Parameters

other Color

The Color to compare with this instance.

Returns

bool

true if the specified Color is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

FromAbgr(int)

Converts the color from a packed ABGR integer.

public static Color FromAbgr(int color)

Parameters

color int

A packed integer containing all four color components in ABGR order

Returns

Color

A color.

FromAbgr(uint)

Converts the color from a packed ABGR integer.

public static Color FromAbgr(uint color)

Parameters

color uint

A packed integer containing all four color components in ABGR order

Returns

Color

A color.

FromBgra(int)

Converts the color from a packed BGRA integer.

public static Color FromBgra(int color)

Parameters

color int

A packed integer containing all four color components in BGRA order

Returns

Color

A color.

FromBgra(uint)

Converts the color from a packed BGRA integer.

public static Color FromBgra(uint color)

Parameters

color uint

A packed integer containing all four color components in BGRA order

Returns

Color

A color.

FromRgba(int)

Converts the color from a packed RGBA integer.

public static Color FromRgba(int color)

Parameters

color int

A packed integer containing all four color components in RGBA order

Returns

Color

A color.

FromRgba(uint)

Converts the color from a packed RGBA integer.

public static Color FromRgba(uint color)

Parameters

color uint

A packed integer containing all four color components in RGBA order

Returns

Color

A color.

GetBrightness()

Gets the brightness.

public float GetBrightness()

Returns

float

The Hue-Saturation-Brightness (HSB) saturation for this Color

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

GetHue()

Gets the hue.

public float GetHue()

Returns

float

The Hue-Saturation-Brightness (HSB) saturation for this Color

GetSaturation()

Gets the saturation.

public float GetSaturation()

Returns

float

The Hue-Saturation-Brightness (HSB) saturation for this Color

Lerp(Color, Color, float)

Performs a linear interpolation between two colors.

public static Color Lerp(Color start, Color end, float amount)

Parameters

start Color

Start color.

end Color

End color.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Color

The linear interpolation of the two colors.

Remarks

Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

Lerp(ref readonly Color, ref readonly Color, float, out Color)

Performs a linear interpolation between two colors.

public static void Lerp(ref readonly Color start, ref readonly Color end, float amount, out Color result)

Parameters

start Color

Start color.

end Color

End color.

amount float

Value between 0 and 1 indicating the weight of end.

result Color

When the method completes, contains the linear interpolation of the two colors.

Remarks

Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

Max(Color, Color)

Returns a color containing the largest components of the specified colorss.

public static Color Max(Color left, Color right)

Parameters

left Color

The first source color.

right Color

The second source color.

Returns

Color

A color containing the largest components of the source colors.

Max(ref readonly Color, ref readonly Color, out Color)

Returns a color containing the smallest components of the specified colors.

public static void Max(ref readonly Color left, ref readonly Color right, out Color result)

Parameters

left Color

The first source color.

right Color

The second source color.

result Color

When the method completes, contains an new color composed of the largest components of the source colors.

Min(Color, Color)

Returns a color containing the smallest components of the specified colors.

public static Color Min(Color left, Color right)

Parameters

left Color

The first source color.

right Color

The second source color.

Returns

Color

A color containing the smallest components of the source colors.

Min(ref readonly Color, ref readonly Color, out Color)

Returns a color containing the smallest components of the specified colors.

public static void Min(ref readonly Color left, ref readonly Color right, out Color result)

Parameters

left Color

The first source color.

right Color

The second source color.

result Color

When the method completes, contains an new color composed of the smallest components of the source colors.

Modulate(Color, Color)

Modulates two colors.

public static Color Modulate(Color left, Color right)

Parameters

left Color

The first color to modulate.

right Color

The second color to modulate.

Returns

Color

The modulated color.

Modulate(ref readonly Color, ref readonly Color, out Color)

Modulates two colors.

public static void Modulate(ref readonly Color left, ref readonly Color right, out Color result)

Parameters

left Color

The first color to modulate.

right Color

The second color to modulate.

result Color

When the method completes, contains the modulated color.

Negate(Color)

Negates a color.

public static Color Negate(Color value)

Parameters

value Color

The color to negate.

Returns

Color

The negated color.

Negate(ref readonly Color, out Color)

Negates a color.

public static void Negate(ref readonly Color value, out Color result)

Parameters

value Color

The color to negate.

result Color

When the method completes, contains the negated color.

Scale(Color, float)

Scales a color.

public static Color Scale(Color value, float scale)

Parameters

value Color

The color to scale.

scale float

The amount by which to scale.

Returns

Color

The scaled color.

Scale(ref readonly Color, float, out Color)

Scales a color.

public static void Scale(ref readonly Color value, float scale, out Color result)

Parameters

value Color

The color to scale.

scale float

The amount by which to scale.

result Color

When the method completes, contains the scaled color.

SmoothStep(Color, Color, float)

Performs a cubic interpolation between two colors.

public static Color SmoothStep(Color start, Color end, float amount)

Parameters

start Color

Start color.

end Color

End color.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Color

The cubic interpolation of the two colors.

SmoothStep(ref readonly Color, ref readonly Color, float, out Color)

Performs a cubic interpolation between two colors.

public static void SmoothStep(ref readonly Color start, ref readonly Color end, float amount, out Color result)

Parameters

start Color

Start color.

end Color

End color.

amount float

Value between 0 and 1 indicating the weight of end.

result Color

When the method completes, contains the cubic interpolation of the two colors.

Subtract(Color, Color)

Subtracts two colors.

public static Color Subtract(Color left, Color right)

Parameters

left Color

The first color to subtract.

right Color

The second color to subtract

Returns

Color

The difference of the two colors.

Subtract(ref readonly Color, ref readonly Color, out Color)

Subtracts two colors.

public static void Subtract(ref readonly Color left, ref readonly Color right, out Color result)

Parameters

left Color

The first color to subtract.

right Color

The second color to subtract.

result Color

WHen the method completes, contains the difference of the two colors.

ToAbgr()

Converts the color into a packed integer.

public int ToAbgr()

Returns

int

A packed integer containing all four color components.

ToArgb()

Converts the color into a packed integer.

public int ToArgb()

Returns

int

A packed integer containing all four color components.

ToArray()

Creates an array containing the elements of the color.

public byte[] ToArray()

Returns

byte[]

A four-element array containing the components of the color in RGBA order.

ToBgra()

Converts the color into a packed integer.

public int ToBgra()

Returns

int

A packed integer containing all four color components.

ToColor3()

Converts the color into a three component color.

public Color3 ToColor3()

Returns

Color3

A three component color containing the red, green, and blue components of the color.

ToColor4()

Convert this instance to a Color4

public Color4 ToColor4()

Returns

Color4

The result of the conversion.

ToRgba()

Converts the color into a packed integer.

public int ToRgba()

Returns

int

A packed integer containing all four color components.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

ToVector3()

Converts the color into a three component vector.

public Vector3 ToVector3()

Returns

Vector3

A three component vector containing the red, green, and blue components of the color.

ToVector4()

Converts the color into a four component vector.

public Vector4 ToVector4()

Returns

Vector4

A four component vector containing all four color components.

Operators

operator +(Color, Color)

Adds two colors.

public static Color operator +(Color left, Color right)

Parameters

left Color

The first color to add.

right Color

The second color to add.

Returns

Color

The sum of the two colors.

operator ==(Color, Color)

Tests for equality between two objects.

public static bool operator ==(Color left, Color right)

Parameters

left Color

The first value to compare.

right Color

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

explicit operator Color3(Color)

Performs an explicit conversion from Color to Color3.

public static explicit operator Color3(Color value)

Parameters

value Color

The value.

Returns

Color3

The result of the conversion.

explicit operator Vector3(Color)

Performs an explicit conversion from Color to Vector3.

public static explicit operator Vector3(Color value)

Parameters

value Color

The value.

Returns

Vector3

The result of the conversion.

explicit operator Vector4(Color)

Performs an explicit conversion from Color to Vector4.

public static explicit operator Vector4(Color value)

Parameters

value Color

The value.

Returns

Vector4

The result of the conversion.

explicit operator int(Color)

Performs an explicit conversion from int to Color.

public static explicit operator int(Color value)

Parameters

value Color

The value.

Returns

int

The result of the conversion.

explicit operator Color(Color3)

Performs an explicit conversion from Color3 to Color.

public static explicit operator Color(Color3 value)

Parameters

value Color3

The value.

Returns

Color

The result of the conversion.

explicit operator Color(Color4)

Performs an explicit conversion from Color4 to Color.

public static explicit operator Color(Color4 value)

Parameters

value Color4

The value.

Returns

Color

The result of the conversion.

explicit operator Color(Vector3)

Performs an explicit conversion from Vector3 to Color.

public static explicit operator Color(Vector3 value)

Parameters

value Vector3

The value.

Returns

Color

The result of the conversion.

explicit operator Color(Vector4)

Performs an explicit conversion from Vector4 to Color.

public static explicit operator Color(Vector4 value)

Parameters

value Vector4

The value.

Returns

Color

The result of the conversion.

explicit operator Color(int)

Performs an explicit conversion from int to Color.

public static explicit operator Color(int value)

Parameters

value int

The value.

Returns

Color

The result of the conversion.

implicit operator Color4(Color)

Performs an implicit conversion from Color to Color4.

public static implicit operator Color4(Color value)

Parameters

value Color

The value.

Returns

Color4

The result of the conversion.

operator !=(Color, Color)

Tests for inequality between two objects.

public static bool operator !=(Color left, Color right)

Parameters

left Color

The first value to compare.

right Color

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.

operator *(Color, Color)

Modulates two colors.

public static Color operator *(Color left, Color right)

Parameters

left Color

The first color to modulate.

right Color

The second color to modulate.

Returns

Color

The modulated color.

operator *(Color, float)

Scales a color.

public static Color operator *(Color value, float scale)

Parameters

value Color

The factor by which to scale the color.

scale float

The color to scale.

Returns

Color

The scaled color.

operator *(float, Color)

Scales a color.

public static Color operator *(float scale, Color value)

Parameters

scale float

The factor by which to scale the color.

value Color

The color to scale.

Returns

Color

The scaled color.

operator -(Color, Color)

Subtracts two colors.

public static Color operator -(Color left, Color right)

Parameters

left Color

The first color to subtract.

right Color

The second color to subtract.

Returns

Color

The difference of the two colors.

operator -(Color)

Negates a color.

public static Color operator -(Color value)

Parameters

value Color

The color to negate.

Returns

Color

A negated color.

operator +(Color)

Assert a color (return it unchanged).

public static Color operator +(Color value)

Parameters

value Color

The color to assert (unchanged).

Returns

Color

The asserted (unchanged) color.