Struct Color
32bit color struct
Assembly: Meadow.Contracts.dll
View Source
public struct Color
Properties
Default
Default color - black with 0 alpha
View Source
public static Color Default { get; }
Color4bppGray
Get the 4bpp grayscale value for current color
View Source
public readonly byte Color4bppGray { get; }
Color8bppGray
Get the 8bpp grayscale value for current color
View Source
public readonly byte Color8bppGray { get; }
Color8bppRgb332
Get the 8bpp (332) color value for current color
View Source
public readonly byte Color8bppRgb332 { get; }
Color12bppRgb444
Get the 12bpp (444) color value for current color
View Source
public readonly ushort Color12bppRgb444 { get; }
Color16bppRgb565
Get the 16bpp (565) color value for current color
View Source
public readonly ushort Color16bppRgb565 { get; }
Color1bpp
Get the 1bpp (on or off) value for current color
View Source
public readonly bool Color1bpp { get; }
A
Current alpha value (0-255)
View Source
public readonly byte A { get; }
R
Current red value (0-255)
View Source
public readonly byte R { get; }
G
Current green value (0-255)
View Source
public readonly byte G { get; }
B
Current blue value (0-255)
View Source
public readonly byte B { get; }
Hue
Hue of current color (0-360.0)
View Source
public float Hue { get; }
Saturation
Saturation of color (0-1.0)
View Source
public float Saturation { get; }
Brightness
Brightness of color (0-1.0)
View Source
public float Brightness { get; }
Fields
AliceBlue
View Source
public static readonly Color AliceBlue
AntiqueWhite
View Source
public static readonly Color AntiqueWhite
Aqua
View Source
public static readonly Color Aqua
Aquamarine
View Source
public static readonly Color Aquamarine
Azure
View Source
public static readonly Color Azure
Beige
View Source
public static readonly Color Beige
Bisque
View Source
public static readonly Color Bisque
Black
View Source
public static readonly Color Black
BlanchedAlmond
View Source
public static readonly Color BlanchedAlmond
Blue
View Source
public static readonly Color Blue
BlueViolet
View Source
public static readonly Color BlueViolet
Brown
View Source
public static readonly Color Brown
BurlyWood
View Source
public static readonly Color BurlyWood
CadetBlue
View Source
public static readonly Color CadetBlue
Chartreuse
View Source
public static readonly Color Chartreuse
Chocolate
View Source
public static readonly Color Chocolate
Coral
View Source
public static readonly Color Coral
CornflowerBlue
View Source
public static readonly Color CornflowerBlue
Cornsilk
View Source
public static readonly Color Cornsilk
Crimson
View Source
public static readonly Color Crimson
Cyan
View Source
public static readonly Color Cyan
DarkBlue
View Source
public static readonly Color DarkBlue
DarkCyan
View Source
public static readonly Color DarkCyan
DarkGoldenrod
View Source
public static readonly Color DarkGoldenrod
DarkGray
View Source
public static readonly Color DarkGray
DarkGreen
View Source
public static readonly Color DarkGreen
DarkKhaki
View Source
public static readonly Color DarkKhaki
DarkMagenta
View Source
public static readonly Color DarkMagenta
DarkOliveGreen
View Source
public static readonly Color DarkOliveGreen
DarkOrange
View Source
public static readonly Color DarkOrange
DarkOrchid
View Source
public static readonly Color DarkOrchid
DarkRed
View Source
public static readonly Color DarkRed
DarkSalmon
View Source
public static readonly Color DarkSalmon
DarkSeaGreen
View Source
public static readonly Color DarkSeaGreen
DarkSlateBlue
View Source
public static readonly Color DarkSlateBlue
DarkSlateGray
View Source
public static readonly Color DarkSlateGray
DarkTurquoise
View Source
public static readonly Color DarkTurquoise
DarkViolet
View Source
public static readonly Color DarkViolet
DeepPink
View Source
public static readonly Color DeepPink
DeepSkyBlue
View Source
public static readonly Color DeepSkyBlue
DimGray
View Source
public static readonly Color DimGray
DodgerBlue
View Source
public static readonly Color DodgerBlue
Firebrick
View Source
public static readonly Color Firebrick
FloralWhite
View Source
public static readonly Color FloralWhite
ForestGreen
View Source
public static readonly Color ForestGreen
Fuchsia
View Source
public static readonly Color Fuchsia
Gainsboro
View Source
public static readonly Color Gainsboro
GhostWhite
View Source
public static readonly Color GhostWhite
Gold
View Source
public static readonly Color Gold
Goldenrod
View Source
public static readonly Color Goldenrod
Gray
View Source
public static readonly Color Gray
Green
View Source
public static readonly Color Green
GreenYellow
View Source
public static readonly Color GreenYellow
Honeydew
View Source
public static readonly Color Honeydew
HotPink
View Source
public static readonly Color HotPink
IndianRed
View Source
public static readonly Color IndianRed
Indigo
View Source
public static readonly Color Indigo
Ivory
View Source
public static readonly Color Ivory
Khaki
View Source
public static readonly Color Khaki
Lavender
View Source
public static readonly Color Lavender
LavenderBlush
View Source
public static readonly Color LavenderBlush
LawnGreen
View Source
public static readonly Color LawnGreen
LemonChiffon
View Source
public static readonly Color LemonChiffon
LightBlue
View Source
public static readonly Color LightBlue
LightCoral
View Source
public static readonly Color LightCoral
LightCyan
View Source
public static readonly Color LightCyan
LightGoldenrodYellow
View Source
public static readonly Color LightGoldenrodYellow
LightGray
View Source
public static readonly Color LightGray
LightGreen
View Source
public static readonly Color LightGreen
LightPink
View Source
public static readonly Color LightPink
LightSalmon
View Source
public static readonly Color LightSalmon
LightSeaGreen
View Source
public static readonly Color LightSeaGreen
LightSkyBlue
View Source
public static readonly Color LightSkyBlue
LightSlateGray
View Source
public static readonly Color LightSlateGray
LightSteelBlue
View Source
public static readonly Color LightSteelBlue
LightYellow
View Source
public static readonly Color LightYellow
Lime
View Source
public static readonly Color Lime
LimeGreen
View Source
public static readonly Color LimeGreen
Linen
View Source
public static readonly Color Linen
Magenta
View Source
public static readonly Color Magenta
Maroon
View Source
public static readonly Color Maroon
MediumAquamarine
View Source
public static readonly Color MediumAquamarine
MediumBlue
View Source
public static readonly Color MediumBlue
MediumOrchid
View Source
public static readonly Color MediumOrchid
MediumPurple
View Source
public static readonly Color MediumPurple
MediumSeaGreen
View Source
public static readonly Color MediumSeaGreen
MediumSlateBlue
View Source
public static readonly Color MediumSlateBlue
MediumSpringGreen
View Source
public static readonly Color MediumSpringGreen
MediumTurquoise
View Source
public static readonly Color MediumTurquoise
MediumVioletRed
View Source
public static readonly Color MediumVioletRed
MidnightBlue
View Source
public static readonly Color MidnightBlue
MintCream
View Source
public static readonly Color MintCream
MistyRose
View Source
public static readonly Color MistyRose
Moccasin
View Source
public static readonly Color Moccasin
NavajoWhite
View Source
public static readonly Color NavajoWhite
Navy
View Source
public static readonly Color Navy
OldLace
View Source
public static readonly Color OldLace
Olive
View Source
public static readonly Color Olive
OliveDrab
View Source
public static readonly Color OliveDrab
Orange
View Source
public static readonly Color Orange
OrangeRed
View Source
public static readonly Color OrangeRed
Orchid
View Source
public static readonly Color Orchid
PaleGoldenrod
View Source
public static readonly Color PaleGoldenrod
PaleGreen
View Source
public static readonly Color PaleGreen
PaleTurquoise
View Source
public static readonly Color PaleTurquoise
PaleVioletRed
View Source
public static readonly Color PaleVioletRed
PapayaWhip
View Source
public static readonly Color PapayaWhip
PeachPuff
View Source
public static readonly Color PeachPuff
Peru
View Source
public static readonly Color Peru
Pink
View Source
public static readonly Color Pink
Plum
View Source
public static readonly Color Plum
PowderBlue
View Source
public static readonly Color PowderBlue
Purple
View Source
public static readonly Color Purple
Red
View Source
public static readonly Color Red
RosyBrown
View Source
public static readonly Color RosyBrown
RoyalBlue
View Source
public static readonly Color RoyalBlue
SaddleBrown
View Source
public static readonly Color SaddleBrown
Salmon
View Source
public static readonly Color Salmon
SandyBrown
View Source
public static readonly Color SandyBrown
SeaGreen
View Source
public static readonly Color SeaGreen
SeaShell
View Source
public static readonly Color SeaShell
Sienna
View Source
public static readonly Color Sienna
Silver
View Source
public static readonly Color Silver
SkyBlue
View Source
public static readonly Color SkyBlue
SlateBlue
View Source
public static readonly Color SlateBlue
SlateGray
View Source
public static readonly Color SlateGray
Snow
View Source
public static readonly Color Snow
SpringGreen
View Source
public static readonly Color SpringGreen
SteelBlue
View Source
public static readonly Color SteelBlue
Tan
View Source
public static readonly Color Tan
Teal
View Source
public static readonly Color Teal
Thistle
View Source
public static readonly Color Thistle
Tomato
View Source
public static readonly Color Tomato
Transparent
View Source
public static readonly Color Transparent
Turquoise
View Source
public static readonly Color Turquoise
Violet
View Source
public static readonly Color Violet
Wheat
View Source
public static readonly Color Wheat
White
View Source
public static readonly Color White
WhiteSmoke
View Source
public static readonly Color WhiteSmoke
Yellow
View Source
public static readonly Color Yellow
YellowGreen
View Source
public static readonly Color YellowGreen
Methods
WithBrightness(float)
Create a new color struct from current color with new brightness
View Source
public Color WithBrightness(float brightness)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.Single | brightness | brightness of new color (0-1.0) |
WithHue(float)
Create a new color struct from current color with new hue
View Source
public Color WithHue(float hue)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.Single | hue | hue of new color (0-360.0) |
WithSaturation(float)
Create a new color structs from current color with new saturation
View Source
public Color WithSaturation(float saturation)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.Single | saturation | saturation of new color (0-1.0) |
GetHashCode()
Get hash of color
View Source
public override readonly int GetHashCode()
Returns
System.Int32
: hash as 32bit int### Equals(object)
Compare two color structs for equality
View Source
public override readonly bool Equals(object obj)
Returns
System.Boolean
: true if equals
Parameters
Type | Name |
---|---|
System.Object | obj |
Equals(Color)
Compare two color structs for equality
View Source
public readonly bool Equals(Color other)
Returns
System.Boolean
: true if equals
Parameters
Type | Name |
---|---|
Meadow.Color | other |
ToString()
Convert color to string
View Source
public override string ToString()
Returns
System.String
: string representing color### FromHex(string)
Create a color object from a hex string
View Source
public static Color FromHex(string hex)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.String | hex | string hex value |
FromUint(uint)
Create a color object from a 32bit unsigned int
View Source
public static Color FromUint(uint argb)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | argb | color 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
public static Color FromRgba(byte r, byte g, byte b, byte a)
Returns
Meadow.Color: new color object
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) |
FromRgb(byte, byte, byte)
Create a new color object
View Source
public static Color FromRgb(byte r, byte g, byte b)
Returns
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) |
FromRgba(float, float, float, float)
Create a new color object
View Source
public static Color FromRgba(float r, float g, float b, float a)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.Single | r | red component of color (0-1) |
System.Single | g | green component of color (0-1) |
System.Single | b | blue component of color (0-1) |
System.Single | a | alpha of color (0-1) |
FromRgb(float, float, float)
Create a new color object
View Source
public static Color FromRgb(float r, float g, float b)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.Single | r | red component of color (0-1) |
System.Single | g | green component of color (0-1) |
System.Single | b | blue component of color (0-1) |
FromHsba(float, float, float, float)
Create a new color object
View Source
public static Color FromHsba(float h, float s, float b, float a = 1)
Returns
Meadow.Color: new color object
Parameters
Type | Name | Description |
---|---|---|
System.Single | h | hue of color (0-360) |
System.Single | s | saturation of color (0-1) |
System.Single | b | brightness of color (0-1) |
System.Single | a | alpha of color (0-1) |
FromAhsv(float, float, float, float)
Takes Hue, Saturation and Value and returns a Color object
View Source
public static Color FromAhsv(float alpha, float hue, float saturation, float value)
Returns
Meadow.Color: A Color object
Parameters
Type | Name |
---|---|
System.Single | alpha |
System.Single | hue |
System.Single | saturation |
System.Single | value |
HslToRgb(float, float, float, out float, out float, out float)
HSL to RGB
View Source
public static void HslToRgb(float hue, float saturation, float lightness, out float r, out float g, out float b)
Parameters
Type | Name | Description |
---|---|---|
System.Single | hue | Hue in degrees (0-359°) |
System.Single | saturation | Saturation |
System.Single | lightness | Brightness value |
System.Single | r | The red component (0-1) |
System.Single | g | The green component (0-1) |
System.Single | b | The blue component (0-1) |
HsvToRgb(float, float, float, out float, out float, out float)
HSV to RGB
View Source
public static void HsvToRgb(float hue, float saturation, float brightValue, out float r, out float g, out float b)
Parameters
Type | Name | Description |
---|---|---|
System.Single | hue | Hue in degrees (0-359°) |
System.Single | saturation | Saturation |
System.Single | brightValue | Brightness value |
System.Single | r | The red component (0-1) |
System.Single | g | The green component (0-1) |
System.Single | b | The blue component (0-1) |
Blend(Color, float)
Blend a new color with the current color
View Source
public Color Blend(Color blendColor, float ratio)
Returns
Meadow.Color: The resulting blended color
Parameters
Type | Name | Description |
---|---|---|
Meadow.Color | blendColor | The color to blend |
System.Single | ratio | The ratio of the blend color to source color |