Struct Color
The color of the pixel.
public struct Color
- Inherited Members
Properties
A
Gets the alpha component value of this Color structure.
public byte A { get; }
Property Value
AliceBlue
Gets a system-defined color.
public static Color AliceBlue { get; }
Property Value
AntiqueWhite
Gets a system-defined color.
public static Color AntiqueWhite { get; }
Property Value
Aqua
Gets a system-defined color.
public static Color Aqua { get; }
Property Value
Aquamarine
Gets a system-defined color.
public static Color Aquamarine { get; }
Property Value
Azure
Gets a system-defined color.
public static Color Azure { get; }
Property Value
B
Gets the blue component value of this Color structure.
public byte B { get; }
Property Value
Beige
Gets a system-defined color.
public static Color Beige { get; }
Property Value
Bisque
Gets a system-defined color.
public static Color Bisque { get; }
Property Value
Black
Gets a system-defined color.
public static Color Black { get; }
Property Value
BlanchedAlmond
Gets a system-defined color.
public static Color BlanchedAlmond { get; }
Property Value
Blue
Gets a system-defined color.
public static Color Blue { get; }
Property Value
BlueViolet
Gets a system-defined color.
public static Color BlueViolet { get; }
Property Value
Brown
Gets a system-defined color.
public static Color Brown { get; }
Property Value
BurlyWood
Gets a system-defined color.
public static Color BurlyWood { get; }
Property Value
CadetBlue
Gets a system-defined color.
public static Color CadetBlue { get; }
Property Value
Chartreuse
Gets a system-defined color.
public static Color Chartreuse { get; }
Property Value
Chocolate
Gets a system-defined color.
public static Color Chocolate { get; }
Property Value
Coral
Gets a system-defined color.
public static Color Coral { get; }
Property Value
CornflowerBlue
Gets a system-defined color.
public static Color CornflowerBlue { get; }
Property Value
Cornsilk
Gets a system-defined color.
public static Color Cornsilk { get; }
Property Value
Crimson
Gets a system-defined color.
public static Color Crimson { get; }
Property Value
Cyan
Gets a system-defined color.
public static Color Cyan { get; }
Property Value
DarkBlue
Gets a system-defined color.
public static Color DarkBlue { get; }
Property Value
DarkCyan
Gets a system-defined color.
public static Color DarkCyan { get; }
Property Value
DarkGoldenrod
Gets a system-defined color.
public static Color DarkGoldenrod { get; }
Property Value
DarkGray
Gets a system-defined color.
public static Color DarkGray { get; }
Property Value
DarkGreen
Gets a system-defined color.
public static Color DarkGreen { get; }
Property Value
DarkKhaki
Gets a system-defined color.
public static Color DarkKhaki { get; }
Property Value
DarkMagenta
Gets a system-defined color.
public static Color DarkMagenta { get; }
Property Value
DarkOliveGreen
Gets a system-defined color.
public static Color DarkOliveGreen { get; }
Property Value
DarkOrange
Gets a system-defined color.
public static Color DarkOrange { get; }
Property Value
DarkOrchid
Gets a system-defined color.
public static Color DarkOrchid { get; }
Property Value
DarkRed
Gets a system-defined color.
public static Color DarkRed { get; }
Property Value
DarkSalmon
Gets a system-defined color.
public static Color DarkSalmon { get; }
Property Value
DarkSeaGreen
Gets a system-defined color.
public static Color DarkSeaGreen { get; }
Property Value
DarkSlateBlue
Gets a system-defined color.
public static Color DarkSlateBlue { get; }
Property Value
DarkSlateGray
Gets a system-defined color.
public static Color DarkSlateGray { get; }
Property Value
DarkTurquoise
Gets a system-defined color.
public static Color DarkTurquoise { get; }
Property Value
DarkViolet
Gets a system-defined color.
public static Color DarkViolet { get; }
Property Value
DeepPink
Gets a system-defined color.
public static Color DeepPink { get; }
Property Value
DeepSkyBlue
Gets a system-defined color.
public static Color DeepSkyBlue { get; }
Property Value
DimGray
Gets a system-defined color.
public static Color DimGray { get; }
Property Value
DodgerBlue
Gets a system-defined color.
public static Color DodgerBlue { get; }
Property Value
Empty
Gets an empty Color.
public static Color Empty { get; }
Property Value
Firebrick
Gets a system-defined color.
public static Color Firebrick { get; }
Property Value
FloralWhite
Gets a system-defined color.
public static Color FloralWhite { get; }
Property Value
ForestGreen
Gets a system-defined color.
public static Color ForestGreen { get; }
Property Value
Fuchsia
Gets a system-defined color.
public static Color Fuchsia { get; }
Property Value
G
Gets the green component value of this Color structure.
public byte G { get; }
Property Value
Gainsboro
Gets a system-defined color.
public static Color Gainsboro { get; }
Property Value
GhostWhite
Gets a system-defined color.
public static Color GhostWhite { get; }
Property Value
Gold
Gets a system-defined color.
public static Color Gold { get; }
Property Value
Goldenrod
Gets a system-defined color.
public static Color Goldenrod { get; }
Property Value
Gray
Gets a system-defined color.
public static Color Gray { get; }
Property Value
Green
Gets a system-defined color.
public static Color Green { get; }
Property Value
GreenYellow
Gets a system-defined color.
public static Color GreenYellow { get; }
Property Value
Honeydew
Gets a system-defined color.
public static Color Honeydew { get; }
Property Value
HotPink
Gets a system-defined color.
public static Color HotPink { get; }
Property Value
IndianRed
Gets a system-defined color.
public static Color IndianRed { get; }
Property Value
Indigo
Gets a system-defined color.
public static Color Indigo { get; }
Property Value
IsEmpty
Gets a value indicating whether this Color structure is uninitialized.
public bool IsEmpty { get; }
Property Value
- bool
This property returns true if this color is uninitialized; otherwise, false.
IsKnownColor
Gets a value indicating whether this Color structure is a predefined color. Predefined colors are represented by the elements of the KnownColor enumeration.
public bool IsKnownColor { get; }
Property Value
- bool
True if this Color was created from a predefined color by using either the FromName(string) method or the FromKnownColor(KnownColor) method; otherwise, false.
IsNamedColor
Gets a value indicating whether this Color structure is a named color or a member of the KnownColor enumeration.
public bool IsNamedColor { get; }
Property Value
- bool
True if this Color was created by using either the FromName(string) method or the FromKnownColor(KnownColor) method; otherwise, false.
Ivory
Gets a system-defined color.
public static Color Ivory { get; }
Property Value
Khaki
Gets a system-defined color.
public static Color Khaki { get; }
Property Value
Lavender
Gets a system-defined color.
public static Color Lavender { get; }
Property Value
LavenderBlush
Gets a system-defined color.
public static Color LavenderBlush { get; }
Property Value
LawnGreen
Gets a system-defined color.
public static Color LawnGreen { get; }
Property Value
LemonChiffon
Gets a system-defined color.
public static Color LemonChiffon { get; }
Property Value
LightBlue
Gets a system-defined color.
public static Color LightBlue { get; }
Property Value
LightCoral
Gets a system-defined color.
public static Color LightCoral { get; }
Property Value
LightCyan
Gets a system-defined color.
public static Color LightCyan { get; }
Property Value
LightGoldenrodYellow
Gets a system-defined color.
public static Color LightGoldenrodYellow { get; }
Property Value
LightGray
Gets a system-defined color.
public static Color LightGray { get; }
Property Value
LightGreen
Gets a system-defined color.
public static Color LightGreen { get; }
Property Value
LightPink
Gets a system-defined color.
public static Color LightPink { get; }
Property Value
LightSalmon
Gets a system-defined color.
public static Color LightSalmon { get; }
Property Value
LightSeaGreen
Gets a system-defined color.
public static Color LightSeaGreen { get; }
Property Value
LightSkyBlue
Gets a system-defined color.
public static Color LightSkyBlue { get; }
Property Value
LightSlateGray
Gets a system-defined color.
public static Color LightSlateGray { get; }
Property Value
LightSteelBlue
Gets a system-defined color.
public static Color LightSteelBlue { get; }
Property Value
LightYellow
Gets a system-defined color.
public static Color LightYellow { get; }
Property Value
Lime
Gets a system-defined color.
public static Color Lime { get; }
Property Value
LimeGreen
Gets a system-defined color.
public static Color LimeGreen { get; }
Property Value
Linen
Gets a system-defined color.
public static Color Linen { get; }
Property Value
Magenta
Gets a system-defined color.
public static Color Magenta { get; }
Property Value
Maroon
Gets a system-defined color.
public static Color Maroon { get; }
Property Value
MediumAquamarine
Gets a system-defined color.
public static Color MediumAquamarine { get; }
Property Value
MediumBlue
Gets a system-defined color.
public static Color MediumBlue { get; }
Property Value
MediumOrchid
Gets a system-defined color.
public static Color MediumOrchid { get; }
Property Value
MediumPurple
Gets a system-defined color.
public static Color MediumPurple { get; }
Property Value
MediumSeaGreen
Gets a system-defined color.
public static Color MediumSeaGreen { get; }
Property Value
MediumSlateBlue
Gets a system-defined color.
public static Color MediumSlateBlue { get; }
Property Value
MediumSpringGreen
Gets a system-defined color.
public static Color MediumSpringGreen { get; }
Property Value
MediumTurquoise
Gets a system-defined color.
public static Color MediumTurquoise { get; }
Property Value
MediumVioletRed
Gets a system-defined color.
public static Color MediumVioletRed { get; }
Property Value
MidnightBlue
Gets a system-defined color.
public static Color MidnightBlue { get; }
Property Value
MintCream
Gets a system-defined color.
public static Color MintCream { get; }
Property Value
MistyRose
Gets a system-defined color.
public static Color MistyRose { get; }
Property Value
Moccasin
Gets a system-defined color.
public static Color Moccasin { get; }
Property Value
Name
Gets the name of this Color.
public string Name { get; }
Property Value
NavajoWhite
Gets a system-defined color.
public static Color NavajoWhite { get; }
Property Value
Navy
Gets a system-defined color.
public static Color Navy { get; }
Property Value
OldLace
Gets a system-defined color.
public static Color OldLace { get; }
Property Value
Olive
Gets a system-defined color.
public static Color Olive { get; }
Property Value
OliveDrab
Gets a system-defined color.
public static Color OliveDrab { get; }
Property Value
Orange
Gets a system-defined color.
public static Color Orange { get; }
Property Value
OrangeRed
Gets a system-defined color.
public static Color OrangeRed { get; }
Property Value
Orchid
Gets a system-defined color.
public static Color Orchid { get; }
Property Value
PaleGoldenrod
Gets a system-defined color.
public static Color PaleGoldenrod { get; }
Property Value
PaleGreen
Gets a system-defined color.
public static Color PaleGreen { get; }
Property Value
PaleTurquoise
Gets a system-defined color.
public static Color PaleTurquoise { get; }
Property Value
PaleVioletRed
Gets a system-defined color.
public static Color PaleVioletRed { get; }
Property Value
PapayaWhip
Gets a system-defined color.
public static Color PapayaWhip { get; }
Property Value
PeachPuff
Gets a system-defined color.
public static Color PeachPuff { get; }
Property Value
Peru
Gets a system-defined color.
public static Color Peru { get; }
Property Value
Pink
Gets a system-defined color.
public static Color Pink { get; }
Property Value
Plum
Gets a system-defined color.
public static Color Plum { get; }
Property Value
PowderBlue
Gets a system-defined color.
public static Color PowderBlue { get; }
Property Value
Purple
Gets a system-defined color.
public static Color Purple { get; }
Property Value
R
Gets the red component value of this Color structure.
public byte R { get; }
Property Value
Red
Gets a system-defined color.
public static Color Red { get; }
Property Value
RosyBrown
Gets a system-defined color.
public static Color RosyBrown { get; }
Property Value
RoyalBlue
Gets a system-defined color.
public static Color RoyalBlue { get; }
Property Value
SaddleBrown
Gets a system-defined color.
public static Color SaddleBrown { get; }
Property Value
Salmon
Gets a system-defined color.
public static Color Salmon { get; }
Property Value
SandyBrown
Gets a system-defined color.
public static Color SandyBrown { get; }
Property Value
SeaGreen
Gets a system-defined color.
public static Color SeaGreen { get; }
Property Value
SeaShell
Gets a system-defined color.
public static Color SeaShell { get; }
Property Value
Sienna
Gets a system-defined color.
public static Color Sienna { get; }
Property Value
Silver
Gets a system-defined color.
public static Color Silver { get; }
Property Value
SkyBlue
Gets a system-defined color.
public static Color SkyBlue { get; }
Property Value
SlateBlue
Gets a system-defined color.
public static Color SlateBlue { get; }
Property Value
SlateGray
Gets a system-defined color.
public static Color SlateGray { get; }
Property Value
Snow
Gets a system-defined color.
public static Color Snow { get; }
Property Value
SpringGreen
Gets a system-defined color.
public static Color SpringGreen { get; }
Property Value
SteelBlue
Gets a system-defined color.
public static Color SteelBlue { get; }
Property Value
Tan
Gets a system-defined color.
public static Color Tan { get; }
Property Value
Teal
Gets a system-defined color.
public static Color Teal { get; }
Property Value
Thistle
Gets a system-defined color.
public static Color Thistle { get; }
Property Value
Tomato
Gets a system-defined color.
public static Color Tomato { get; }
Property Value
Transparent
Gets a system-defined color.
public static Color Transparent { get; }
Property Value
Turquoise
Gets a system-defined color.
public static Color Turquoise { get; }
Property Value
Violet
Gets a system-defined color.
public static Color Violet { get; }
Property Value
Wheat
Gets a system-defined color.
public static Color Wheat { get; }
Property Value
White
Gets a system-defined color.
public static Color White { get; }
Property Value
WhiteSmoke
Gets a system-defined color.
public static Color WhiteSmoke { get; }
Property Value
Yellow
Gets a system-defined color.
public static Color Yellow { get; }
Property Value
YellowGreen
Gets a system-defined color.
public static Color YellowGreen { get; }
Property Value
Methods
Equals(object)
public override bool Equals(object obj)
Parameters
obj
objectThe object to test.
Returns
FromArgb(int)
Creates a Color structure from a 32-bit ARGB value.
public static Color FromArgb(int argb)
Parameters
argb
intA value specifying the 32-bit ARGB value.
Returns
FromArgb(int, Color)
Creates a Color structure from the specified Color structure, but with the new specified alpha value. Although this method allows a 32-bit value to be passed for the alpha value, the value is limited to 8 bits.
public static Color FromArgb(int alpha, Color baseColor)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
alpha
is less than 0 or greater than 255.
FromArgb(int, int, int)
Creates a Color structure from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly 255 (fully opaque). Although this method allows a 32-bit value to be passed for each color component, the value of each component is limited to 8 bits.
public static Color FromArgb(int red, int green, int blue)
Parameters
red
intThe red component value for the new Color. Valid values are 0 through 255.
green
intThe green component value for the new Color. Valid values are 0 through 255.
blue
intThe blue component value for the new Color. Valid values are 0 through 255.
Returns
Exceptions
- ArgumentOutOfRangeException
red
,green
, orblue
is less than 0 or greater than 255.
FromArgb(int, int, int, int)
Creates a Color structure from the four ARGB component (alpha, red, green, and blue) values. Although this method allows a 32-bit value to be passed for each component, the value of each component is limited to 8 bits.
public static Color FromArgb(int alpha, int red, int green, int blue)
Parameters
alpha
intThe alpha component. Valid values are 0 through 255.
red
intThe red component. Valid values are 0 through 255.
green
intThe green component. Valid values are 0 through 255.
blue
intThe blue component. Valid values are 0 through 255.
Returns
Exceptions
- ArgumentOutOfRangeException
alpha
,red
,green
, orblue
is less than 0 or greater than 255.
FromKnownColor(KnownColor)
Creates a Color structure from the specified predefined color.
public static Color FromKnownColor(KnownColor color)
Parameters
color
KnownColorAn element of the KnownColor enumeration.
Returns
FromName(string)
Creates a Color structure from the specified name of a predefined color.
public static Color FromName(string name)
Parameters
name
stringA string that is the name of a predefined color. Valid names are the same as the names of the elements of the KnownColor enumeration.
Returns
GetBrightness()
Gets the hue-saturation-brightness (HSB) brightness value for this Color structure.
public float GetBrightness()
Returns
- float
The brightness of this Color. The brightness ranges from 0.0 through 1.0, where 0.0 represents black and 1.0 represents white.
GetHashCode()
Returns a hash code for this Color structure.
public override int GetHashCode()
Returns
GetHue()
Gets the hue-saturation-brightness (HSB) hue value, in degrees, for this Color structure.
public float GetHue()
Returns
- float
The hue, in degrees, of this Color. The hue is measured in degrees, ranging from 0.0 through 360.0, in HSB color space.
GetSaturation()
Gets the hue-saturation-brightness (HSB) saturation value for this Color structure.
public float GetSaturation()
Returns
- float
The saturation of this Color. The saturation ranges from 0.0 through 1.0, where 0.0 is grayscale and 1.0 is the most saturated.
ToArgb()
Gets the 32-bit ARGB value of this Color structure.
public int ToArgb()
Returns
ToCmyk(Color)
The conversion from Color to CMYKColor. This method is deprecated. Please use more effective ToCmyk(Color).
public static CmykColor ToCmyk(Color pixel)
Parameters
pixel
ColorThe pixel of Color type in RGB format.
Returns
ToCmyk(Color[])
The conversion from Color to CMYKColor. This method is deprecated. Please use more effective ToCmyk(Color[]).
[Obsolete]
public static CmykColor[] ToCmyk(Color[] pixels)
Parameters
pixels
Color[]The pixels of Color type in RGB format.
Returns
ToCmykIcc(Color)
The conversion from Color to CMYKColor using icc conversion with default profiles. This method is deprecated. Please use more effective ToCmykIcc(Color).
[Obsolete]
public static CmykColor ToCmykIcc(Color pixel)
Parameters
pixel
ColorThe pixel of Color type in RGB format.
Returns
ToCmykIcc(Color, Stream, Stream)
The conversion from Color to CMYKColor using icc conversion with default profiles. This method is deprecated. Please use more effective ToCmykIcc(Color, Stream, Stream).
[Obsolete]
public static CmykColor ToCmykIcc(Color pixel, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixel
ColorThe pixel of Color type in RGB format.
rgbIccStream
StreamThe stream containing icc rgb profile.
cmykIccStream
StreamThe stream containing icc cmyk profile.
Returns
ToCmykIcc(Color[])
The conversion from Color to CMYKColor using icc conversion with default profiles. This method is deprecated. Please use more effective ToCmykIcc(Color[]).
[Obsolete]
public static CmykColor[] ToCmykIcc(Color[] pixels)
Parameters
pixels
Color[]The pixels of Color type in RGB format.
Returns
ToCmykIcc(Color[], Stream, Stream)
The conversion from Color to CMYKColor using icc conversion. This method is deprecated. Please use more effective ToCmykIcc(Color[], Stream, Stream).
[Obsolete]
public static CmykColor[] ToCmykIcc(Color[] pixels, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
Color[]The pixels of Color type in RGB format.
rgbIccStream
StreamThe stream containing icc rgb profile.
cmykIccStream
StreamThe stream containing icc cmyk profile.
Returns
ToKnownColor()
Gets the KnownColor value of this Color structure.
public KnownColor ToKnownColor()
Returns
- KnownColor
An element of the KnownColor enumeration, if the Color is created from a predefined color by using either the FromName(string) method or the FromKnownColor(KnownColor) method; otherwise, 0.
ToString()
Converts this Color structure to a human-readable string.
public override string ToString()
Returns
- string
A string that is the name of this Color, if the Color is created from a predefined color by using either the FromName(string) method or the FromKnownColor(KnownColor) method; otherwise, a string that consists of the ARGB component names and their values.
Operators
operator ==(Color, Color)
Tests whether two specified Color structures are equivalent.
public static bool operator ==(Color left, Color right)
Parameters
left
ColorThe Color that is to the left of the equality operator.
right
ColorThe Color that is to the right of the equality operator.
Returns
operator !=(Color, Color)
Tests whether two specified Color structures are different.
public static bool operator !=(Color left, Color right)
Parameters
left
ColorThe Color that is to the left of the inequality operator.
right
ColorThe Color that is to the right of the inequality operator.