Characteristic Locus
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 = null)

Parameters

Type Name Description
System.Byte red

red component of color

System.Byte green

green component of color

System.Byte blue

blue component of color

System.Byte alpha

transparancy 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
System.Double red

red component of color

System.Double green

green component of color

System.Double blue

blue component of color

Color(Double, Double, Double, Byte)

Create a color struct

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

Parameters

Type Name Description
System.Double hue

hue of color

System.Double brightness

brightness of color

System.Double saturation

saturation of color

System.Byte alpha

alpha (transparency) of color

Fields

AliceBlue

Declaration
public static readonly Color AliceBlue

Field Value

Type Description
Color

AntiqueWhite

Declaration
public static readonly Color AntiqueWhite

Field Value

Type Description
Color

Aqua

Declaration
public static readonly Color Aqua

Field Value

Type Description
Color

Aquamarine

Declaration
public static readonly Color Aquamarine

Field Value

Type Description
Color

Azure

Declaration
public static readonly Color Azure

Field Value

Type Description
Color

Beige

Declaration
public static readonly Color Beige

Field Value

Type Description
Color

Bisque

Declaration
public static readonly Color Bisque

Field Value

Type Description
Color

Black

Declaration
public static readonly Color Black

Field Value

Type Description
Color

BlanchedAlmond

Declaration
public static readonly Color BlanchedAlmond

Field Value

Type Description
Color

Blue

Declaration
public static readonly Color Blue

Field Value

Type Description
Color

BlueViolet

Declaration
public static readonly Color BlueViolet

Field Value

Type Description
Color

Brown

Declaration
public static readonly Color Brown

Field Value

Type Description
Color

BurlyWood

Declaration
public static readonly Color BurlyWood

Field Value

Type Description
Color

CadetBlue

Declaration
public static readonly Color CadetBlue

Field Value

Type Description
Color

Chartreuse

Declaration
public static readonly Color Chartreuse

Field Value

Type Description
Color

Chocolate

Declaration
public static readonly Color Chocolate

Field Value

Type Description
Color

Coral

Declaration
public static readonly Color Coral

Field Value

Type Description
Color

CornflowerBlue

Declaration
public static readonly Color CornflowerBlue

Field Value

Type Description
Color

Cornsilk

Declaration
public static readonly Color Cornsilk

Field Value

Type Description
Color

Crimson

Declaration
public static readonly Color Crimson

Field Value

Type Description
Color

Cyan

Declaration
public static readonly Color Cyan

Field Value

Type Description
Color

DarkBlue

Declaration
public static readonly Color DarkBlue

Field Value

Type Description
Color

DarkCyan

Declaration
public static readonly Color DarkCyan

Field Value

Type Description
Color

DarkGoldenrod

Declaration
public static readonly Color DarkGoldenrod

Field Value

Type Description
Color

DarkGray

Declaration
public static readonly Color DarkGray

Field Value

Type Description
Color

DarkGreen

Declaration
public static readonly Color DarkGreen

Field Value

Type Description
Color

DarkKhaki

Declaration
public static readonly Color DarkKhaki

Field Value

Type Description
Color

DarkMagenta

Declaration
public static readonly Color DarkMagenta

Field Value

Type Description
Color

DarkOliveGreen

Declaration
public static readonly Color DarkOliveGreen

Field Value

Type Description
Color

DarkOrange

Declaration
public static readonly Color DarkOrange

Field Value

Type Description
Color

DarkOrchid

Declaration
public static readonly Color DarkOrchid

Field Value

Type Description
Color

DarkRed

Declaration
public static readonly Color DarkRed

Field Value

Type Description
Color

DarkSalmon

Declaration
public static readonly Color DarkSalmon

Field Value

Type Description
Color

DarkSeaGreen

Declaration
public static readonly Color DarkSeaGreen

Field Value

Type Description
Color

DarkSlateBlue

Declaration
public static readonly Color DarkSlateBlue

Field Value

Type Description
Color

DarkSlateGray

Declaration
public static readonly Color DarkSlateGray

Field Value

Type Description
Color

DarkTurquoise

Declaration
public static readonly Color DarkTurquoise

Field Value

Type Description
Color

DarkViolet

Declaration
public static readonly Color DarkViolet

Field Value

Type Description
Color

DeepPink

Declaration
public static readonly Color DeepPink

Field Value

Type Description
Color

DeepSkyBlue

Declaration
public static readonly Color DeepSkyBlue

Field Value

Type Description
Color

DimGray

Declaration
public static readonly Color DimGray

Field Value

Type Description
Color

DodgerBlue

Declaration
public static readonly Color DodgerBlue

Field Value

Type Description
Color

Firebrick

Declaration
public static readonly Color Firebrick

Field Value

Type Description
Color

FloralWhite

Declaration
public static readonly Color FloralWhite

Field Value

Type Description
Color

ForestGreen

Declaration
public static readonly Color ForestGreen

Field Value

Type Description
Color

Fuchsia

Declaration
public static readonly Color Fuchsia

Field Value

Type Description
Color

Gainsboro

Declaration
public static readonly Color Gainsboro

Field Value

Type Description
Color

GhostWhite

Declaration
public static readonly Color GhostWhite

Field Value

Type Description
Color

Gold

Declaration
public static readonly Color Gold

Field Value

Type Description
Color

Goldenrod

Declaration
public static readonly Color Goldenrod

Field Value

Type Description
Color

Gray

Declaration
public static readonly Color Gray

Field Value

Type Description
Color

Green

Declaration
public static readonly Color Green

Field Value

Type Description
Color

GreenYellow

Declaration
public static readonly Color GreenYellow

Field Value

Type Description
Color

Honeydew

Declaration
public static readonly Color Honeydew

Field Value

Type Description
Color

HotPink

Declaration
public static readonly Color HotPink

Field Value

Type Description
Color

IndianRed

Declaration
public static readonly Color IndianRed

Field Value

Type Description
Color

Indigo

Declaration
public static readonly Color Indigo

Field Value

Type Description
Color

Ivory

Declaration
public static readonly Color Ivory

Field Value

Type Description
Color

Khaki

Declaration
public static readonly Color Khaki

Field Value

Type Description
Color

Lavender

Declaration
public static readonly Color Lavender

Field Value

Type Description
Color

LavenderBlush

Declaration
public static readonly Color LavenderBlush

Field Value

Type Description
Color

LawnGreen

Declaration
public static readonly Color LawnGreen

Field Value

Type Description
Color

LemonChiffon

Declaration
public static readonly Color LemonChiffon

Field Value

Type Description
Color

LightBlue

Declaration
public static readonly Color LightBlue

Field Value

Type Description
Color

LightCoral

Declaration
public static readonly Color LightCoral

Field Value

Type Description
Color

LightCyan

Declaration
public static readonly Color LightCyan

Field Value

Type Description
Color

LightGoldenrodYellow

Declaration
public static readonly Color LightGoldenrodYellow

Field Value

Type Description
Color

LightGray

Declaration
public static readonly Color LightGray

Field Value

Type Description
Color

LightGreen

Declaration
public static readonly Color LightGreen

Field Value

Type Description
Color

LightPink

Declaration
public static readonly Color LightPink

Field Value

Type Description
Color

LightSalmon

Declaration
public static readonly Color LightSalmon

Field Value

Type Description
Color

LightSeaGreen

Declaration
public static readonly Color LightSeaGreen

Field Value

Type Description
Color

LightSkyBlue

Declaration
public static readonly Color LightSkyBlue

Field Value

Type Description
Color

LightSlateGray

Declaration
public static readonly Color LightSlateGray

Field Value

Type Description
Color

LightSteelBlue

Declaration
public static readonly Color LightSteelBlue

Field Value

Type Description
Color

LightYellow

Declaration
public static readonly Color LightYellow

Field Value

Type Description
Color

Lime

Declaration
public static readonly Color Lime

Field Value

Type Description
Color

LimeGreen

Declaration
public static readonly Color LimeGreen

Field Value

Type Description
Color

Linen

Declaration
public static readonly Color Linen

Field Value

Type Description
Color

Magenta

Declaration
public static readonly Color Magenta

Field Value

Type Description
Color

Maroon

Declaration
public static readonly Color Maroon

Field Value

Type Description
Color

MediumAquamarine

Declaration
public static readonly Color MediumAquamarine

Field Value

Type Description
Color

MediumBlue

Declaration
public static readonly Color MediumBlue

Field Value

Type Description
Color

MediumOrchid

Declaration
public static readonly Color MediumOrchid

Field Value

Type Description
Color

MediumPurple

Declaration
public static readonly Color MediumPurple

Field Value

Type Description
Color

MediumSeaGreen

Declaration
public static readonly Color MediumSeaGreen

Field Value

Type Description
Color

MediumSlateBlue

Declaration
public static readonly Color MediumSlateBlue

Field Value

Type Description
Color

MediumSpringGreen

Declaration
public static readonly Color MediumSpringGreen

Field Value

Type Description
Color

MediumTurquoise

Declaration
public static readonly Color MediumTurquoise

Field Value

Type Description
Color

MediumVioletRed

Declaration
public static readonly Color MediumVioletRed

Field Value

Type Description
Color

MidnightBlue

Declaration
public static readonly Color MidnightBlue

Field Value

Type Description
Color

MintCream

Declaration
public static readonly Color MintCream

Field Value

Type Description
Color

MistyRose

Declaration
public static readonly Color MistyRose

Field Value

Type Description
Color

Moccasin

Declaration
public static readonly Color Moccasin

Field Value

Type Description
Color

NavajoWhite

Declaration
public static readonly Color NavajoWhite

Field Value

Type Description
Color

Navy

Declaration
public static readonly Color Navy

Field Value

Type Description
Color

OldLace

Declaration
public static readonly Color OldLace

Field Value

Type Description
Color

Olive

Declaration
public static readonly Color Olive

Field Value

Type Description
Color

OliveDrab

Declaration
public static readonly Color OliveDrab

Field Value

Type Description
Color

Orange

Declaration
public static readonly Color Orange

Field Value

Type Description
Color

OrangeRed

Declaration
public static readonly Color OrangeRed

Field Value

Type Description
Color

Orchid

Declaration
public static readonly Color Orchid

Field Value

Type Description
Color

PaleGoldenrod

Declaration
public static readonly Color PaleGoldenrod

Field Value

Type Description
Color

PaleGreen

Declaration
public static readonly Color PaleGreen

Field Value

Type Description
Color

PaleTurquoise

Declaration
public static readonly Color PaleTurquoise

Field Value

Type Description
Color

PaleVioletRed

Declaration
public static readonly Color PaleVioletRed

Field Value

Type Description
Color

PapayaWhip

Declaration
public static readonly Color PapayaWhip

Field Value

Type Description
Color

PeachPuff

Declaration
public static readonly Color PeachPuff

Field Value

Type Description
Color

Peru

Declaration
public static readonly Color Peru

Field Value

Type Description
Color

Pink

Declaration
public static readonly Color Pink

Field Value

Type Description
Color

Plum

Declaration
public static readonly Color Plum

Field Value

Type Description
Color

PowderBlue

Declaration
public static readonly Color PowderBlue

Field Value

Type Description
Color

Purple

Declaration
public static readonly Color Purple

Field Value

Type Description
Color

Red

Declaration
public static readonly Color Red

Field Value

Type Description
Color

RosyBrown

Declaration
public static readonly Color RosyBrown

Field Value

Type Description
Color

RoyalBlue

Declaration
public static readonly Color RoyalBlue

Field Value

Type Description
Color

SaddleBrown

Declaration
public static readonly Color SaddleBrown

Field Value

Type Description
Color

Salmon

Declaration
public static readonly Color Salmon

Field Value

Type Description
Color

SandyBrown

Declaration
public static readonly Color SandyBrown

Field Value

Type Description
Color

SeaGreen

Declaration
public static readonly Color SeaGreen

Field Value

Type Description
Color

SeaShell

Declaration
public static readonly Color SeaShell

Field Value

Type Description
Color

Sienna

Declaration
public static readonly Color Sienna

Field Value

Type Description
Color

Silver

Declaration
public static readonly Color Silver

Field Value

Type Description
Color

SkyBlue

Declaration
public static readonly Color SkyBlue

Field Value

Type Description
Color

SlateBlue

Declaration
public static readonly Color SlateBlue

Field Value

Type Description
Color

SlateGray

Declaration
public static readonly Color SlateGray

Field Value

Type Description
Color

Snow

Declaration
public static readonly Color Snow

Field Value

Type Description
Color

SpringGreen

Declaration
public static readonly Color SpringGreen

Field Value

Type Description
Color

SteelBlue

Declaration
public static readonly Color SteelBlue

Field Value

Type Description
Color

Tan

Declaration
public static readonly Color Tan

Field Value

Type Description
Color

Teal

Declaration
public static readonly Color Teal

Field Value

Type Description
Color

Thistle

Declaration
public static readonly Color Thistle

Field Value

Type Description
Color

Tomato

Declaration
public static readonly Color Tomato

Field Value

Type Description
Color

Transparent

Declaration
public static readonly Color Transparent

Field Value

Type Description
Color

Turquoise

Declaration
public static readonly Color Turquoise

Field Value

Type Description
Color

Violet

Declaration
public static readonly Color Violet

Field Value

Type Description
Color

Wheat

Declaration
public static readonly Color Wheat

Field Value

Type Description
Color

White

Declaration
public static readonly Color White

Field Value

Type Description
Color

WhiteSmoke

Declaration
public static readonly Color WhiteSmoke

Field Value

Type Description
Color

Yellow

Declaration
public static readonly Color Yellow

Field Value

Type Description
Color

YellowGreen

Declaration
public static readonly Color YellowGreen

Field Value

Type Description
Color

Properties

A

Current alpha value (0-255)

Declaration
public byte A { get; }

Property Value

Type Description
System.Byte

B

Current blue value (0-255)

Declaration
public byte B { get; }

Property Value

Type Description
System.Byte

Brightness

Brightness of color (0-1.0)

Declaration
public double Brightness { get; }

Property Value

Type Description
System.Double

Color12bppRgb444

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

Declaration
public ushort Color12bppRgb444 { get; }

Property Value

Type Description
System.UInt16

Color16bppRgb565

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

Declaration
public ushort Color16bppRgb565 { get; }

Property Value

Type Description
System.UInt16

Color1bpp

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

Declaration
public bool Color1bpp { get; }

Property Value

Type Description
System.Boolean

Color4bppGray

Get the 4bpp grayscale value for current color

Declaration
public byte Color4bppGray { get; }

Property Value

Type Description
System.Byte

Color8bppGray

Get the 8bpp grayscale value for current color

Declaration
public byte Color8bppGray { get; }

Property Value

Type Description
System.Byte

Color8bppRgb332

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

Declaration
public byte Color8bppRgb332 { get; }

Property Value

Type Description
System.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 byte G { get; }

Property Value

Type Description
System.Byte

Hue

Hue of current color (0-360.0)

Declaration
public double Hue { get; }

Property Value

Type Description
System.Double

R

Current red value (0-255)

Declaration
public byte R { get; }

Property Value

Type Description
System.Byte

Saturation

Saturation of color (0-1.0)

Declaration
public double Saturation { get; }

Property Value

Type Description
System.Double

Methods

Equals(Color)

Compare two color structs for equality

Declaration
public bool Equals(Color other)

Parameters

Type Name Description
Color other

Returns

Type Description
System.Boolean

true if equals

Equals(Object)

Compare two color structs for equality

Declaration
public override bool Equals(object obj)

Parameters

Type Name Description
System.Object obj

Returns

Type Description
System.Boolean

true if equals

FromHex(String)

Create a color object from a hex string

Declaration
public static Color FromHex(string hex)

Parameters

Type Name Description
System.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
System.Double h

hue of color (0-360)

System.Double s

saturation of color (0-1)

System.Double b

brightness of color (0-1)

System.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
System.Byte r

red component of color (0-255)

System.Byte g

green component of color (0-255)

System.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
System.Double r

red component of color (0-1)

System.Double g

green component of color (0-1)

System.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
System.Byte r

red component of color (0-255)

System.Byte g

green component of color (0-255)

System.Byte b

blue component of color (0-255)

System.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
System.Double r

red component of color (0-1)

System.Double g

green component of color (0-1)

System.Double b

blue component of color (0-1)

System.Double a

alpha of color (0-1)

Returns

Type Description
Color

new color object

FromUint(UInt32)

Create a color object from a 32bit unsigned int

Declaration
public static Color FromUint(uint argb)

Parameters

Type Name Description
System.UInt32 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 int GetHashCode()

Returns

Type Description
System.Int32

hash as 32bit int

ToString()

Convert color to string

Declaration
public override string ToString()

Returns

Type Description
System.String

string representing color

WithBrightness(Double)

Create a new color struct from current color with new brightness

Declaration
public Color WithBrightness(double brightness)

Parameters

Type Name Description
System.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
System.Double hue

hue of new color (0-360.0)

Returns

Type Description
Color

new color object

WithSaturation(Double)

Create a new color stucts from current color with new saturation

Declaration
public Color WithSaturation(double saturation)

Parameters

Type Name Description
System.Double saturation

saturation of new color (0-1.0)

Returns

Type Description
Color

new color object

Operators

Equality(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
System.Boolean

true if equal

Inequality(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
System.Boolean

true if not equals

Extension Methods