Characteristic Locus
Inherited Members object.Equals(object, object) object.GetType() object.ReferenceEquals(object, object)
Namespace Meadow.Foundation
Assembly Meadow.Foundation.dll

Syntax

public struct Color

Constructors

Color(byte, byte, byte, byte)

Create a color struct

Declaration
public Color(byte red, byte green, byte blue, byte alpha = 255)

Parameters

Type Name Description
byte red

red component of color

byte green

green component of color

byte blue

blue component of color

byte alpha

transparency of color

Color(double, double, double)

Create a color struct - convenience ctor for doubles - prefer byte version

Declaration
public Color(double red, double green, double blue)

Parameters

Type Name Description
double red

red component of color

double green

green component of color

double blue

blue component of color

Color(double, double, double, byte)

Create a color struct

Declaration
public Color(double hue, double saturation, double brightness, byte alpha = 255)

Parameters

Type Name Description
double hue

hue of color

double saturation

saturation of color

double brightness

brightness of color

byte alpha

alpha (transparency) of color

Fields

AliceBlue

32bit color struct

Declaration
public static readonly Color AliceBlue

Field Value

Type Description
Color

AntiqueWhite

32bit color struct

Declaration
public static readonly Color AntiqueWhite

Field Value

Type Description
Color

Aqua

32bit color struct

Declaration
public static readonly Color Aqua

Field Value

Type Description
Color

Aquamarine

32bit color struct

Declaration
public static readonly Color Aquamarine

Field Value

Type Description
Color

Azure

32bit color struct

Declaration
public static readonly Color Azure

Field Value

Type Description
Color

Beige

32bit color struct

Declaration
public static readonly Color Beige

Field Value

Type Description
Color

Bisque

32bit color struct

Declaration
public static readonly Color Bisque

Field Value

Type Description
Color

Black

32bit color struct

Declaration
public static readonly Color Black

Field Value

Type Description
Color

BlanchedAlmond

32bit color struct

Declaration
public static readonly Color BlanchedAlmond

Field Value

Type Description
Color

Blue

32bit color struct

Declaration
public static readonly Color Blue

Field Value

Type Description
Color

BlueViolet

32bit color struct

Declaration
public static readonly Color BlueViolet

Field Value

Type Description
Color

Brown

32bit color struct

Declaration
public static readonly Color Brown

Field Value

Type Description
Color

BurlyWood

32bit color struct

Declaration
public static readonly Color BurlyWood

Field Value

Type Description
Color

CadetBlue

32bit color struct

Declaration
public static readonly Color CadetBlue

Field Value

Type Description
Color

Chartreuse

32bit color struct

Declaration
public static readonly Color Chartreuse

Field Value

Type Description
Color

Chocolate

32bit color struct

Declaration
public static readonly Color Chocolate

Field Value

Type Description
Color

Coral

32bit color struct

Declaration
public static readonly Color Coral

Field Value

Type Description
Color

CornflowerBlue

32bit color struct

Declaration
public static readonly Color CornflowerBlue

Field Value

Type Description
Color

Cornsilk

32bit color struct

Declaration
public static readonly Color Cornsilk

Field Value

Type Description
Color

Crimson

32bit color struct

Declaration
public static readonly Color Crimson

Field Value

Type Description
Color

Cyan

32bit color struct

Declaration
public static readonly Color Cyan

Field Value

Type Description
Color

DarkBlue

32bit color struct

Declaration
public static readonly Color DarkBlue

Field Value

Type Description
Color

DarkCyan

32bit color struct

Declaration
public static readonly Color DarkCyan

Field Value

Type Description
Color

DarkGoldenrod

32bit color struct

Declaration
public static readonly Color DarkGoldenrod

Field Value

Type Description
Color

DarkGray

32bit color struct

Declaration
public static readonly Color DarkGray

Field Value

Type Description
Color

DarkGreen

32bit color struct

Declaration
public static readonly Color DarkGreen

Field Value

Type Description
Color

DarkKhaki

32bit color struct

Declaration
public static readonly Color DarkKhaki

Field Value

Type Description
Color

DarkMagenta

32bit color struct

Declaration
public static readonly Color DarkMagenta

Field Value

Type Description
Color

DarkOliveGreen

32bit color struct

Declaration
public static readonly Color DarkOliveGreen

Field Value

Type Description
Color

DarkOrange

32bit color struct

Declaration
public static readonly Color DarkOrange

Field Value

Type Description
Color

DarkOrchid

32bit color struct

Declaration
public static readonly Color DarkOrchid

Field Value

Type Description
Color

DarkRed

32bit color struct

Declaration
public static readonly Color DarkRed

Field Value

Type Description
Color

DarkSalmon

32bit color struct

Declaration
public static readonly Color DarkSalmon

Field Value

Type Description
Color

DarkSeaGreen

32bit color struct

Declaration
public static readonly Color DarkSeaGreen

Field Value

Type Description
Color

DarkSlateBlue

32bit color struct

Declaration
public static readonly Color DarkSlateBlue

Field Value

Type Description
Color

DarkSlateGray

32bit color struct

Declaration
public static readonly Color DarkSlateGray

Field Value

Type Description
Color

DarkTurquoise

32bit color struct

Declaration
public static readonly Color DarkTurquoise

Field Value

Type Description
Color

DarkViolet

32bit color struct

Declaration
public static readonly Color DarkViolet

Field Value

Type Description
Color

DeepPink

32bit color struct

Declaration
public static readonly Color DeepPink

Field Value

Type Description
Color

DeepSkyBlue

32bit color struct

Declaration
public static readonly Color DeepSkyBlue

Field Value

Type Description
Color

DimGray

32bit color struct

Declaration
public static readonly Color DimGray

Field Value

Type Description
Color

DodgerBlue

32bit color struct

Declaration
public static readonly Color DodgerBlue

Field Value

Type Description
Color

Firebrick

32bit color struct

Declaration
public static readonly Color Firebrick

Field Value

Type Description
Color

FloralWhite

32bit color struct

Declaration
public static readonly Color FloralWhite

Field Value

Type Description
Color

ForestGreen

32bit color struct

Declaration
public static readonly Color ForestGreen

Field Value

Type Description
Color

Fuchsia

32bit color struct

Declaration
public static readonly Color Fuchsia

Field Value

Type Description
Color

Gainsboro

32bit color struct

Declaration
public static readonly Color Gainsboro

Field Value

Type Description
Color

GhostWhite

32bit color struct

Declaration
public static readonly Color GhostWhite

Field Value

Type Description
Color

Gold

32bit color struct

Declaration
public static readonly Color Gold

Field Value

Type Description
Color

Goldenrod

32bit color struct

Declaration
public static readonly Color Goldenrod

Field Value

Type Description
Color

Gray

32bit color struct

Declaration
public static readonly Color Gray

Field Value

Type Description
Color

Green

32bit color struct

Declaration
public static readonly Color Green

Field Value

Type Description
Color

GreenYellow

32bit color struct

Declaration
public static readonly Color GreenYellow

Field Value

Type Description
Color

Honeydew

32bit color struct

Declaration
public static readonly Color Honeydew

Field Value

Type Description
Color

HotPink

32bit color struct

Declaration
public static readonly Color HotPink

Field Value

Type Description
Color

IndianRed

32bit color struct

Declaration
public static readonly Color IndianRed

Field Value

Type Description
Color

Indigo

32bit color struct

Declaration
public static readonly Color Indigo

Field Value

Type Description
Color

Ivory

32bit color struct

Declaration
public static readonly Color Ivory

Field Value

Type Description
Color

Khaki

32bit color struct

Declaration
public static readonly Color Khaki

Field Value

Type Description
Color

Lavender

32bit color struct

Declaration
public static readonly Color Lavender

Field Value

Type Description
Color

LavenderBlush

32bit color struct

Declaration
public static readonly Color LavenderBlush

Field Value

Type Description
Color

LawnGreen

32bit color struct

Declaration
public static readonly Color LawnGreen

Field Value

Type Description
Color

LemonChiffon

32bit color struct

Declaration
public static readonly Color LemonChiffon

Field Value

Type Description
Color

LightBlue

32bit color struct

Declaration
public static readonly Color LightBlue

Field Value

Type Description
Color

LightCoral

32bit color struct

Declaration
public static readonly Color LightCoral

Field Value

Type Description
Color

LightCyan

32bit color struct

Declaration
public static readonly Color LightCyan

Field Value

Type Description
Color

LightGoldenrodYellow

32bit color struct

Declaration
public static readonly Color LightGoldenrodYellow

Field Value

Type Description
Color

LightGray

32bit color struct

Declaration
public static readonly Color LightGray

Field Value

Type Description
Color

LightGreen

32bit color struct

Declaration
public static readonly Color LightGreen

Field Value

Type Description
Color

LightPink

32bit color struct

Declaration
public static readonly Color LightPink

Field Value

Type Description
Color

LightSalmon

32bit color struct

Declaration
public static readonly Color LightSalmon

Field Value

Type Description
Color

LightSeaGreen

32bit color struct

Declaration
public static readonly Color LightSeaGreen

Field Value

Type Description
Color

LightSkyBlue

32bit color struct

Declaration
public static readonly Color LightSkyBlue

Field Value

Type Description
Color

LightSlateGray

32bit color struct

Declaration
public static readonly Color LightSlateGray

Field Value

Type Description
Color

LightSteelBlue

32bit color struct

Declaration
public static readonly Color LightSteelBlue

Field Value

Type Description
Color

LightYellow

32bit color struct

Declaration
public static readonly Color LightYellow

Field Value

Type Description
Color

Lime

32bit color struct

Declaration
public static readonly Color Lime

Field Value

Type Description
Color

LimeGreen

32bit color struct

Declaration
public static readonly Color LimeGreen

Field Value

Type Description
Color

Linen

32bit color struct

Declaration
public static readonly Color Linen

Field Value

Type Description
Color

Magenta

32bit color struct

Declaration
public static readonly Color Magenta

Field Value

Type Description
Color

Maroon

32bit color struct

Declaration
public static readonly Color Maroon

Field Value

Type Description
Color

MediumAquamarine

32bit color struct

Declaration
public static readonly Color MediumAquamarine

Field Value

Type Description
Color

MediumBlue

32bit color struct

Declaration
public static readonly Color MediumBlue

Field Value

Type Description
Color

MediumOrchid

32bit color struct

Declaration
public static readonly Color MediumOrchid

Field Value

Type Description
Color

MediumPurple

32bit color struct

Declaration
public static readonly Color MediumPurple

Field Value

Type Description
Color

MediumSeaGreen

32bit color struct

Declaration
public static readonly Color MediumSeaGreen

Field Value

Type Description
Color

MediumSlateBlue

32bit color struct

Declaration
public static readonly Color MediumSlateBlue

Field Value

Type Description
Color

MediumSpringGreen

32bit color struct

Declaration
public static readonly Color MediumSpringGreen

Field Value

Type Description
Color

MediumTurquoise

32bit color struct

Declaration
public static readonly Color MediumTurquoise

Field Value

Type Description
Color

MediumVioletRed

32bit color struct

Declaration
public static readonly Color MediumVioletRed

Field Value

Type Description
Color

MidnightBlue

32bit color struct

Declaration
public static readonly Color MidnightBlue

Field Value

Type Description
Color

MintCream

32bit color struct

Declaration
public static readonly Color MintCream

Field Value

Type Description
Color

MistyRose

32bit color struct

Declaration
public static readonly Color MistyRose

Field Value

Type Description
Color

Moccasin

32bit color struct

Declaration
public static readonly Color Moccasin

Field Value

Type Description
Color

NavajoWhite

32bit color struct

Declaration
public static readonly Color NavajoWhite

Field Value

Type Description
Color

Navy

32bit color struct

Declaration
public static readonly Color Navy

Field Value

Type Description
Color

OldLace

32bit color struct

Declaration
public static readonly Color OldLace

Field Value

Type Description
Color

Olive

32bit color struct

Declaration
public static readonly Color Olive

Field Value

Type Description
Color

OliveDrab

32bit color struct

Declaration
public static readonly Color OliveDrab

Field Value

Type Description
Color

Orange

32bit color struct

Declaration
public static readonly Color Orange

Field Value

Type Description
Color

OrangeRed

32bit color struct

Declaration
public static readonly Color OrangeRed

Field Value

Type Description
Color

Orchid

32bit color struct

Declaration
public static readonly Color Orchid

Field Value

Type Description
Color

PaleGoldenrod

32bit color struct

Declaration
public static readonly Color PaleGoldenrod

Field Value

Type Description
Color

PaleGreen

32bit color struct

Declaration
public static readonly Color PaleGreen

Field Value

Type Description
Color

PaleTurquoise

32bit color struct

Declaration
public static readonly Color PaleTurquoise

Field Value

Type Description
Color

PaleVioletRed

32bit color struct

Declaration
public static readonly Color PaleVioletRed

Field Value

Type Description
Color

PapayaWhip

32bit color struct

Declaration
public static readonly Color PapayaWhip

Field Value

Type Description
Color

PeachPuff

32bit color struct

Declaration
public static readonly Color PeachPuff

Field Value

Type Description
Color

Peru

32bit color struct

Declaration
public static readonly Color Peru

Field Value

Type Description
Color

Pink

32bit color struct

Declaration
public static readonly Color Pink

Field Value

Type Description
Color

Plum

32bit color struct

Declaration
public static readonly Color Plum

Field Value

Type Description
Color

PowderBlue

32bit color struct

Declaration
public static readonly Color PowderBlue

Field Value

Type Description
Color

Purple

32bit color struct

Declaration
public static readonly Color Purple

Field Value

Type Description
Color

Red

32bit color struct

Declaration
public static readonly Color Red

Field Value

Type Description
Color

RosyBrown

32bit color struct

Declaration
public static readonly Color RosyBrown

Field Value

Type Description
Color

RoyalBlue

32bit color struct

Declaration
public static readonly Color RoyalBlue

Field Value

Type Description
Color

SaddleBrown

32bit color struct

Declaration
public static readonly Color SaddleBrown

Field Value

Type Description
Color

Salmon

32bit color struct

Declaration
public static readonly Color Salmon

Field Value

Type Description
Color

SandyBrown

32bit color struct

Declaration
public static readonly Color SandyBrown

Field Value

Type Description
Color

SeaGreen

32bit color struct

Declaration
public static readonly Color SeaGreen

Field Value

Type Description
Color

SeaShell

32bit color struct

Declaration
public static readonly Color SeaShell

Field Value

Type Description
Color

Sienna

32bit color struct

Declaration
public static readonly Color Sienna

Field Value

Type Description
Color

Silver

32bit color struct

Declaration
public static readonly Color Silver

Field Value

Type Description
Color

SkyBlue

32bit color struct

Declaration
public static readonly Color SkyBlue

Field Value

Type Description
Color

SlateBlue

32bit color struct

Declaration
public static readonly Color SlateBlue

Field Value

Type Description
Color

SlateGray

32bit color struct

Declaration
public static readonly Color SlateGray

Field Value

Type Description
Color

Snow

32bit color struct

Declaration
public static readonly Color Snow

Field Value

Type Description
Color

SpringGreen

32bit color struct

Declaration
public static readonly Color SpringGreen

Field Value

Type Description
Color

SteelBlue

32bit color struct

Declaration
public static readonly Color SteelBlue

Field Value

Type Description
Color

Tan

32bit color struct

Declaration
public static readonly Color Tan

Field Value

Type Description
Color

Teal

32bit color struct

Declaration
public static readonly Color Teal

Field Value

Type Description
Color

Thistle

32bit color struct

Declaration
public static readonly Color Thistle

Field Value

Type Description
Color

Tomato

32bit color struct

Declaration
public static readonly Color Tomato

Field Value

Type Description
Color

Transparent

32bit color struct

Declaration
public static readonly Color Transparent

Field Value

Type Description
Color

Turquoise

32bit color struct

Declaration
public static readonly Color Turquoise

Field Value

Type Description
Color

Violet

32bit color struct

Declaration
public static readonly Color Violet

Field Value

Type Description
Color

Wheat

32bit color struct

Declaration
public static readonly Color Wheat

Field Value

Type Description
Color

White

32bit color struct

Declaration
public static readonly Color White

Field Value

Type Description
Color

WhiteSmoke

32bit color struct

Declaration
public static readonly Color WhiteSmoke

Field Value

Type Description
Color

Yellow

32bit color struct

Declaration
public static readonly Color Yellow

Field Value

Type Description
Color

YellowGreen

32bit color struct

Declaration
public static readonly Color YellowGreen

Field Value

Type Description
Color

Properties

A

Current alpha value (0-255)

Declaration
public readonly byte A { get; }

Property Value

Type Description
byte

B

Current blue value (0-255)

Declaration
public readonly byte B { get; }

Property Value

Type Description
byte

Brightness

Brightness of color (0-1.0)

Declaration
public double Brightness { get; }

Property Value

Type Description
double

Color12bppRgb444

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

Declaration
public readonly ushort Color12bppRgb444 { get; }

Property Value

Type Description
ushort

Color16bppRgb565

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

Declaration
public readonly ushort Color16bppRgb565 { get; }

Property Value

Type Description
ushort

Color1bpp

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

Declaration
public readonly bool Color1bpp { get; }

Property Value

Type Description
bool

Color4bppGray

Get the 4bpp grayscale value for current color

Declaration
public readonly byte Color4bppGray { get; }

Property Value

Type Description
byte

Color8bppGray

Get the 8bpp grayscale value for current color

Declaration
public readonly byte Color8bppGray { get; }

Property Value

Type Description
byte

Color8bppRgb332

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

Declaration
public readonly byte Color8bppRgb332 { get; }

Property Value

Type Description
byte

Default

Default color - black with 0 alpha

Declaration
public static Color Default { get; }

Property Value

Type Description
Color

G

Current green value (0-255)

Declaration
public readonly byte G { get; }

Property Value

Type Description
byte

Hue

Hue of current color (0-360.0)

Declaration
public double Hue { get; }

Property Value

Type Description
double

R

Current red value (0-255)

Declaration
public readonly byte R { get; }

Property Value

Type Description
byte

Saturation

Saturation of color (0-1.0)

Declaration
public double Saturation { get; }

Property Value

Type Description
double

Methods

Equals(Color)

Compare two color structs for equality

Declaration
public readonly bool Equals(Color other)

Parameters

Type Name Description
Color other

Returns

Type Description
bool

true if equals

Equals(object)

Compare two color structs for equality

Declaration
public override readonly bool Equals(object obj)

Parameters

Type Name Description
object obj

Returns

Type Description
bool

true if equals

Overrides

FromHex(string)

Create a color object from a hex string

Declaration
public static Color FromHex(string hex)

Parameters

Type Name Description
string hex

string hex value

Returns

Type Description
Color

new color object

FromHsba(double, double, double, double)

Create a new color object

Declaration
public static Color FromHsba(double h, double s, double b, double a = 1)

Parameters

Type Name Description
double h

hue of color (0-360)

double s

saturation of color (0-1)

double b

brightness of color (0-1)

double a

alpha of color (0-1)

Returns

Type Description
Color

new color object

FromRgb(byte, byte, byte)

Create a new color object

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

Parameters

Type Name Description
byte r

red component of color (0-255)

byte g

green component of color (0-255)

byte b

blue component of color (0-255)

Returns

Type Description
Color

FromRgb(double, double, double)

Create a new color object

Declaration
public static Color FromRgb(double r, double g, double b)

Parameters

Type Name Description
double r

red component of color (0-1)

double g

green component of color (0-1)

double b

blue component of color (0-1)

Returns

Type Description
Color

new color object

FromRgba(byte, byte, byte, byte)

Create a new color object

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

Parameters

Type Name Description
byte r

red component of color (0-255)

byte g

green component of color (0-255)

byte b

blue component of color (0-255)

byte a

alpha of color (0-255)

Returns

Type Description
Color

new color object

FromRgba(double, double, double, double)

Create a new color object

Declaration
public static Color FromRgba(double r, double g, double b, double a)

Parameters

Type Name Description
double r

red component of color (0-1)

double g

green component of color (0-1)

double b

blue component of color (0-1)

double a

alpha of color (0-1)

Returns

Type Description
Color

new color object

FromUint(uint)

Create a color object from a 32bit unsigned int

Declaration
public static Color FromUint(uint argb)

Parameters

Type Name Description
uint argb

color value - 8 bits red, 8 bits green, 8 bits blue, 8 bits alpha

Returns

Type Description
Color

new color object

GetHashCode()

Get hash of color

Declaration
public override readonly int GetHashCode()

Returns

Type Description
int

hash as 32bit int

Overrides

ToString()

Convert color to string

Declaration
public override string ToString()

Returns

Type Description
string

string representing color

Overrides

WithBrightness(double)

Create a new color struct from current color with new brightness

Declaration
public Color WithBrightness(double brightness)

Parameters

Type Name Description
double brightness

brightness of new color (0-1.0)

Returns

Type Description
Color

new color object

WithHue(double)

Create a new color struct from current color with new hue

Declaration
public Color WithHue(double hue)

Parameters

Type Name Description
double hue

hue of new color (0-360.0)

Returns

Type Description
Color

new color object

WithSaturation(double)

Create a new color structs from current color with new saturation

Declaration
public Color WithSaturation(double saturation)

Parameters

Type Name Description
double saturation

saturation of new color (0-1.0)

Returns

Type Description
Color

new color object

Operators

operator ==(Color, Color)

Equality operator

Declaration
public static bool operator ==(Color color1, Color color2)

Parameters

Type Name Description
Color color1

left color value

Color color2

right color value

Returns

Type Description
bool

true if equal

operator !=(Color, Color)

Not equals operator

Declaration
public static bool operator !=(Color color1, Color color2)

Parameters

Type Name Description
Color color1

left color value

Color color2

right color value

Returns

Type Description
bool

true if not equals

Extension Methods