Skip to main content

Struct Color

32bit color struct

Assembly: Meadow.Contracts.dll
View Source
Declaration
public struct Color

Properties

Default

Default color - black with 0 alpha

View Source
Declaration
public static Color Default { get; }

Color4bppGray

Get the 4bpp grayscale value for current color

View Source
Declaration
public readonly byte Color4bppGray { get; }

Color8bppGray

Get the 8bpp grayscale value for current color

View Source
Declaration
public readonly byte Color8bppGray { get; }

Color8bppRgb332

Get the 8bpp (332) color value for current color

View Source
Declaration
public readonly byte Color8bppRgb332 { get; }

Color12bppRgb444

Get the 12bpp (444) color value for current color

View Source
Declaration
public readonly ushort Color12bppRgb444 { get; }

Color16bppRgb565

Get the 16bpp (565) color value for current color

View Source
Declaration
public readonly ushort Color16bppRgb565 { get; }

Color1bpp

Get the 1bpp (on or off) value for current color

View Source
Declaration
public readonly bool Color1bpp { get; }

A

Current alpha value (0-255)

View Source
Declaration
public readonly byte A { get; }

R

Current red value (0-255)

View Source
Declaration
public readonly byte R { get; }

G

Current green value (0-255)

View Source
Declaration
public readonly byte G { get; }

B

Current blue value (0-255)

View Source
Declaration
public readonly byte B { get; }

Hue

Hue of current color (0-360.0)

View Source
Declaration
public float Hue { get; }

Saturation

Saturation of color (0-1.0)

View Source
Declaration
public float Saturation { get; }

Brightness

Brightness of color (0-1.0)

View Source
Declaration
public float Brightness { get; }

Fields

AliceBlue

View Source
Declaration
public static readonly Color AliceBlue

AntiqueWhite

View Source
Declaration
public static readonly Color AntiqueWhite

Aqua

View Source
Declaration
public static readonly Color Aqua

Aquamarine

View Source
Declaration
public static readonly Color Aquamarine

Azure

View Source
Declaration
public static readonly Color Azure

Beige

View Source
Declaration
public static readonly Color Beige

Bisque

View Source
Declaration
public static readonly Color Bisque

Black

View Source
Declaration
public static readonly Color Black

BlanchedAlmond

View Source
Declaration
public static readonly Color BlanchedAlmond

Blue

View Source
Declaration
public static readonly Color Blue

BlueViolet

View Source
Declaration
public static readonly Color BlueViolet

Brown

View Source
Declaration
public static readonly Color Brown

BurlyWood

View Source
Declaration
public static readonly Color BurlyWood

CadetBlue

View Source
Declaration
public static readonly Color CadetBlue

Chartreuse

View Source
Declaration
public static readonly Color Chartreuse

Chocolate

View Source
Declaration
public static readonly Color Chocolate

Coral

View Source
Declaration
public static readonly Color Coral

CornflowerBlue

View Source
Declaration
public static readonly Color CornflowerBlue

Cornsilk

View Source
Declaration
public static readonly Color Cornsilk

Crimson

View Source
Declaration
public static readonly Color Crimson

Cyan

View Source
Declaration
public static readonly Color Cyan

DarkBlue

View Source
Declaration
public static readonly Color DarkBlue

DarkCyan

View Source
Declaration
public static readonly Color DarkCyan

DarkGoldenrod

View Source
Declaration
public static readonly Color DarkGoldenrod

DarkGray

View Source
Declaration
public static readonly Color DarkGray

DarkGreen

View Source
Declaration
public static readonly Color DarkGreen

DarkKhaki

View Source
Declaration
public static readonly Color DarkKhaki

DarkMagenta

View Source
Declaration
public static readonly Color DarkMagenta

DarkOliveGreen

View Source
Declaration
public static readonly Color DarkOliveGreen

DarkOrange

View Source
Declaration
public static readonly Color DarkOrange

DarkOrchid

View Source
Declaration
public static readonly Color DarkOrchid

DarkRed

View Source
Declaration
public static readonly Color DarkRed

DarkSalmon

View Source
Declaration
public static readonly Color DarkSalmon

DarkSeaGreen

View Source
Declaration
public static readonly Color DarkSeaGreen

DarkSlateBlue

View Source
Declaration
public static readonly Color DarkSlateBlue

DarkSlateGray

View Source
Declaration
public static readonly Color DarkSlateGray

DarkTurquoise

View Source
Declaration
public static readonly Color DarkTurquoise

DarkViolet

View Source
Declaration
public static readonly Color DarkViolet

DeepPink

View Source
Declaration
public static readonly Color DeepPink

DeepSkyBlue

View Source
Declaration
public static readonly Color DeepSkyBlue

DimGray

View Source
Declaration
public static readonly Color DimGray

DodgerBlue

View Source
Declaration
public static readonly Color DodgerBlue

Firebrick

View Source
Declaration
public static readonly Color Firebrick

FloralWhite

View Source
Declaration
public static readonly Color FloralWhite

ForestGreen

View Source
Declaration
public static readonly Color ForestGreen

Fuchsia

View Source
Declaration
public static readonly Color Fuchsia

Gainsboro

View Source
Declaration
public static readonly Color Gainsboro

GhostWhite

View Source
Declaration
public static readonly Color GhostWhite

Gold

View Source
Declaration
public static readonly Color Gold

Goldenrod

View Source
Declaration
public static readonly Color Goldenrod

Gray

View Source
Declaration
public static readonly Color Gray

Green

View Source
Declaration
public static readonly Color Green

GreenYellow

View Source
Declaration
public static readonly Color GreenYellow

Honeydew

View Source
Declaration
public static readonly Color Honeydew

HotPink

View Source
Declaration
public static readonly Color HotPink

IndianRed

View Source
Declaration
public static readonly Color IndianRed

Indigo

View Source
Declaration
public static readonly Color Indigo

Ivory

View Source
Declaration
public static readonly Color Ivory

Khaki

View Source
Declaration
public static readonly Color Khaki

Lavender

View Source
Declaration
public static readonly Color Lavender

LavenderBlush

View Source
Declaration
public static readonly Color LavenderBlush

LawnGreen

View Source
Declaration
public static readonly Color LawnGreen

LemonChiffon

View Source
Declaration
public static readonly Color LemonChiffon

LightBlue

View Source
Declaration
public static readonly Color LightBlue

LightCoral

View Source
Declaration
public static readonly Color LightCoral

LightCyan

View Source
Declaration
public static readonly Color LightCyan

LightGoldenrodYellow

View Source
Declaration
public static readonly Color LightGoldenrodYellow

LightGray

View Source
Declaration
public static readonly Color LightGray

LightGreen

View Source
Declaration
public static readonly Color LightGreen

LightPink

View Source
Declaration
public static readonly Color LightPink

LightSalmon

View Source
Declaration
public static readonly Color LightSalmon

LightSeaGreen

View Source
Declaration
public static readonly Color LightSeaGreen

LightSkyBlue

View Source
Declaration
public static readonly Color LightSkyBlue

LightSlateGray

View Source
Declaration
public static readonly Color LightSlateGray

LightSteelBlue

View Source
Declaration
public static readonly Color LightSteelBlue

LightYellow

View Source
Declaration
public static readonly Color LightYellow

Lime

View Source
Declaration
public static readonly Color Lime

LimeGreen

View Source
Declaration
public static readonly Color LimeGreen

Linen

View Source
Declaration
public static readonly Color Linen

Magenta

View Source
Declaration
public static readonly Color Magenta

Maroon

View Source
Declaration
public static readonly Color Maroon

MediumAquamarine

View Source
Declaration
public static readonly Color MediumAquamarine

MediumBlue

View Source
Declaration
public static readonly Color MediumBlue

MediumOrchid

View Source
Declaration
public static readonly Color MediumOrchid

MediumPurple

View Source
Declaration
public static readonly Color MediumPurple

MediumSeaGreen

View Source
Declaration
public static readonly Color MediumSeaGreen

MediumSlateBlue

View Source
Declaration
public static readonly Color MediumSlateBlue

MediumSpringGreen

View Source
Declaration
public static readonly Color MediumSpringGreen

MediumTurquoise

View Source
Declaration
public static readonly Color MediumTurquoise

MediumVioletRed

View Source
Declaration
public static readonly Color MediumVioletRed

MidnightBlue

View Source
Declaration
public static readonly Color MidnightBlue

MintCream

View Source
Declaration
public static readonly Color MintCream

MistyRose

View Source
Declaration
public static readonly Color MistyRose

Moccasin

View Source
Declaration
public static readonly Color Moccasin
View Source
Declaration
public static readonly Color NavajoWhite
View Source
Declaration
public static readonly Color Navy

OldLace

View Source
Declaration
public static readonly Color OldLace

Olive

View Source
Declaration
public static readonly Color Olive

OliveDrab

View Source
Declaration
public static readonly Color OliveDrab

Orange

View Source
Declaration
public static readonly Color Orange

OrangeRed

View Source
Declaration
public static readonly Color OrangeRed

Orchid

View Source
Declaration
public static readonly Color Orchid

PaleGoldenrod

View Source
Declaration
public static readonly Color PaleGoldenrod

PaleGreen

View Source
Declaration
public static readonly Color PaleGreen

PaleTurquoise

View Source
Declaration
public static readonly Color PaleTurquoise

PaleVioletRed

View Source
Declaration
public static readonly Color PaleVioletRed

PapayaWhip

View Source
Declaration
public static readonly Color PapayaWhip

PeachPuff

View Source
Declaration
public static readonly Color PeachPuff

Peru

View Source
Declaration
public static readonly Color Peru

Pink

View Source
Declaration
public static readonly Color Pink

Plum

View Source
Declaration
public static readonly Color Plum

PowderBlue

View Source
Declaration
public static readonly Color PowderBlue

Purple

View Source
Declaration
public static readonly Color Purple

Red

View Source
Declaration
public static readonly Color Red

RosyBrown

View Source
Declaration
public static readonly Color RosyBrown

RoyalBlue

View Source
Declaration
public static readonly Color RoyalBlue

SaddleBrown

View Source
Declaration
public static readonly Color SaddleBrown

Salmon

View Source
Declaration
public static readonly Color Salmon

SandyBrown

View Source
Declaration
public static readonly Color SandyBrown

SeaGreen

View Source
Declaration
public static readonly Color SeaGreen

SeaShell

View Source
Declaration
public static readonly Color SeaShell

Sienna

View Source
Declaration
public static readonly Color Sienna

Silver

View Source
Declaration
public static readonly Color Silver

SkyBlue

View Source
Declaration
public static readonly Color SkyBlue

SlateBlue

View Source
Declaration
public static readonly Color SlateBlue

SlateGray

View Source
Declaration
public static readonly Color SlateGray

Snow

View Source
Declaration
public static readonly Color Snow

SpringGreen

View Source
Declaration
public static readonly Color SpringGreen

SteelBlue

View Source
Declaration
public static readonly Color SteelBlue

Tan

View Source
Declaration
public static readonly Color Tan

Teal

View Source
Declaration
public static readonly Color Teal

Thistle

View Source
Declaration
public static readonly Color Thistle

Tomato

View Source
Declaration
public static readonly Color Tomato

Transparent

View Source
Declaration
public static readonly Color Transparent

Turquoise

View Source
Declaration
public static readonly Color Turquoise

Violet

View Source
Declaration
public static readonly Color Violet

Wheat

View Source
Declaration
public static readonly Color Wheat

White

View Source
Declaration
public static readonly Color White

WhiteSmoke

View Source
Declaration
public static readonly Color WhiteSmoke

Yellow

View Source
Declaration
public static readonly Color Yellow

YellowGreen

View Source
Declaration
public static readonly Color YellowGreen

Methods

WithBrightness(float)

Create a new color struct from current color with new brightness

View Source
Declaration
public Color WithBrightness(float brightness)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Singlebrightnessbrightness of new color (0-1.0)

WithHue(float)

Create a new color struct from current color with new hue

View Source
Declaration
public Color WithHue(float hue)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Singlehuehue of new color (0-360.0)

WithSaturation(float)

Create a new color structs from current color with new saturation

View Source
Declaration
public Color WithSaturation(float saturation)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Singlesaturationsaturation of new color (0-1.0)

GetHashCode()

Get hash of color

View Source
Declaration
public override readonly int GetHashCode()
Returns

System.Int32: hash as 32bit int### Equals(object) Compare two color structs for equality

View Source
Declaration
public override readonly bool Equals(object obj)
Returns

System.Boolean: true if equals

Parameters
TypeName
System.Objectobj

Equals(Color)

Compare two color structs for equality

View Source
Declaration
public readonly bool Equals(Color other)
Returns

System.Boolean: true if equals

Parameters
TypeName
Meadow.Colorother

ToString()

Convert color to string

View Source
Declaration
public override string ToString()
Returns

System.String: string representing color### FromHex(string) Create a color object from a hex string

View Source
Declaration
public static Color FromHex(string hex)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Stringhexstring hex value

FromUint(uint)

Create a color object from a 32bit unsigned int

View Source
Declaration
public static Color FromUint(uint argb)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.UInt32argbcolor value - 8 bits red, 8 bits green, 8 bits blue, 8 bits alpha

FromRgba(byte, byte, byte, byte)

Create a new color object

View Source
Declaration
public static Color FromRgba(byte r, byte g, byte b, byte a)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Byterred component of color (0-255)
System.Byteggreen component of color (0-255)
System.Bytebblue component of color (0-255)
System.Byteaalpha of color (0-255)

FromRgb(byte, byte, byte)

Create a new color object

View Source
Declaration
public static Color FromRgb(byte r, byte g, byte b)
Returns

Meadow.Color

Parameters
TypeNameDescription
System.Byterred component of color (0-255)
System.Byteggreen component of color (0-255)
System.Bytebblue component of color (0-255)

FromRgba(float, float, float, float)

Create a new color object

View Source
Declaration
public static Color FromRgba(float r, float g, float b, float a)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Singlerred component of color (0-1)
System.Singleggreen component of color (0-1)
System.Singlebblue component of color (0-1)
System.Singleaalpha of color (0-1)

FromRgb(float, float, float)

Create a new color object

View Source
Declaration
public static Color FromRgb(float r, float g, float b)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Singlerred component of color (0-1)
System.Singleggreen component of color (0-1)
System.Singlebblue component of color (0-1)

FromHsba(float, float, float, float)

Create a new color object

View Source
Declaration
public static Color FromHsba(float h, float s, float b, float a = 1)
Returns

Meadow.Color: new color object

Parameters
TypeNameDescription
System.Singlehhue of color (0-360)
System.Singlessaturation of color (0-1)
System.Singlebbrightness of color (0-1)
System.Singleaalpha of color (0-1)

FromAhsv(float, float, float, float)

Takes Hue, Saturation and Value and returns a Color object

View Source
Declaration
public static Color FromAhsv(float alpha, float hue, float saturation, float value)
Returns

Meadow.Color: A Color object

Parameters
TypeName
System.Singlealpha
System.Singlehue
System.Singlesaturation
System.Singlevalue

HslToRgb(float, float, float, out float, out float, out float)

HSL to RGB

View Source
Declaration
public static void HslToRgb(float hue, float saturation, float lightness, out float r, out float g, out float b)
Parameters
TypeNameDescription
System.SinglehueHue in degrees (0-359°)
System.SinglesaturationSaturation
System.SinglelightnessBrightness value
System.SinglerThe red component (0-1)
System.SinglegThe green component (0-1)
System.SinglebThe blue component (0-1)

HsvToRgb(float, float, float, out float, out float, out float)

HSV to RGB

View Source
Declaration
public static void HsvToRgb(float hue, float saturation, float brightValue, out float r, out float g, out float b)
Parameters
TypeNameDescription
System.SinglehueHue in degrees (0-359°)
System.SinglesaturationSaturation
System.SinglebrightValueBrightness value
System.SinglerThe red component (0-1)
System.SinglegThe green component (0-1)
System.SinglebThe blue component (0-1)

Blend(Color, float)

Blend a new color with the current color

View Source
Declaration
public Color Blend(Color blendColor, float ratio)
Returns

Meadow.Color: The resulting blended color

Parameters
TypeNameDescription
Meadow.ColorblendColorThe color to blend
System.SingleratioThe ratio of the blend color to source color