Struct Color
Represents a color value that is convertible to any IPixel<TSelf> type.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public readonly struct Color : IEquatable<Color>
Remarks
The internal representation and layout of this structure is hidden by intention. It's not serializable, and it should not be considered as part of a contract. Unlike System.Drawing.Color, Color has to be converted to a specific pixel value to query the color components.
Constructors
| Improve this Doc View SourceColor(Abgr32)
Initializes a new instance of the Color struct.
Declaration
public Color(Abgr32 pixel)
Parameters
Type | Name | Description |
---|---|---|
Abgr32 | pixel | The Abgr32 containing the color information. |
Color(Argb32)
Initializes a new instance of the Color struct.
Declaration
public Color(Argb32 pixel)
Parameters
Type | Name | Description |
---|---|---|
Argb32 | pixel | The Argb32 containing the color information. |
Color(Bgr24)
Initializes a new instance of the Color struct.
Declaration
public Color(Bgr24 pixel)
Parameters
Type | Name | Description |
---|---|---|
Bgr24 | pixel | The Bgr24 containing the color information. |
Color(Bgra32)
Initializes a new instance of the Color struct.
Declaration
public Color(Bgra32 pixel)
Parameters
Type | Name | Description |
---|---|---|
Bgra32 | pixel | The Bgra32 containing the color information. |
Color(L16)
Initializes a new instance of the Color struct.
Declaration
public Color(L16 pixel)
Parameters
Type | Name | Description |
---|---|---|
L16 | pixel | The L16 containing the color information. |
Color(La32)
Initializes a new instance of the Color struct.
Declaration
public Color(La32 pixel)
Parameters
Type | Name | Description |
---|---|---|
La32 | pixel | The La32 containing the color information. |
Color(Rgb24)
Initializes a new instance of the Color struct.
Declaration
public Color(Rgb24 pixel)
Parameters
Type | Name | Description |
---|---|---|
Rgb24 | pixel | The Rgb24 containing the color information. |
Color(Rgb48)
Initializes a new instance of the Color struct.
Declaration
public Color(Rgb48 pixel)
Parameters
Type | Name | Description |
---|---|---|
Rgb48 | pixel | The Rgb48 containing the color information. |
Color(Rgba32)
Initializes a new instance of the Color struct.
Declaration
public Color(Rgba32 pixel)
Parameters
Type | Name | Description |
---|---|---|
Rgba32 | pixel | The Rgba32 containing the color information. |
Color(Rgba64)
Initializes a new instance of the Color struct.
Declaration
public Color(Rgba64 pixel)
Parameters
Type | Name | Description |
---|---|---|
Rgba64 | pixel | The Rgba64 containing the color information. |
Color(Vector4)
Initializes a new instance of the Color struct.
Declaration
public Color(Vector4 vector)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | vector | The Vector4 containing the color information. |
Fields
| Improve this Doc View SourceAliceBlue
Represents a
Declaration
public static readonly Color AliceBlue
Field Value
Type | Description |
---|---|
Color |
AntiqueWhite
Represents a
Declaration
public static readonly Color AntiqueWhite
Field Value
Type | Description |
---|---|
Color |
Aqua
Represents a
Declaration
public static readonly Color Aqua
Field Value
Type | Description |
---|---|
Color |
Aquamarine
Represents a
Declaration
public static readonly Color Aquamarine
Field Value
Type | Description |
---|---|
Color |
Azure
Represents a
Declaration
public static readonly Color Azure
Field Value
Type | Description |
---|---|
Color |
Beige
Represents a
Declaration
public static readonly Color Beige
Field Value
Type | Description |
---|---|
Color |
Bisque
Represents a
Declaration
public static readonly Color Bisque
Field Value
Type | Description |
---|---|
Color |
Black
Represents a
Declaration
public static readonly Color Black
Field Value
Type | Description |
---|---|
Color |
BlanchedAlmond
Represents a
Declaration
public static readonly Color BlanchedAlmond
Field Value
Type | Description |
---|---|
Color |
Blue
Represents a
Declaration
public static readonly Color Blue
Field Value
Type | Description |
---|---|
Color |
BlueViolet
Represents a
Declaration
public static readonly Color BlueViolet
Field Value
Type | Description |
---|---|
Color |
Brown
Represents a
Declaration
public static readonly Color Brown
Field Value
Type | Description |
---|---|
Color |
BurlyWood
Represents a
Declaration
public static readonly Color BurlyWood
Field Value
Type | Description |
---|---|
Color |
CadetBlue
Represents a
Declaration
public static readonly Color CadetBlue
Field Value
Type | Description |
---|---|
Color |
Chartreuse
Represents a
Declaration
public static readonly Color Chartreuse
Field Value
Type | Description |
---|---|
Color |
Chocolate
Represents a
Declaration
public static readonly Color Chocolate
Field Value
Type | Description |
---|---|
Color |
Coral
Represents a
Declaration
public static readonly Color Coral
Field Value
Type | Description |
---|---|
Color |
CornflowerBlue
Represents a
Declaration
public static readonly Color CornflowerBlue
Field Value
Type | Description |
---|---|
Color |
Cornsilk
Represents a
Declaration
public static readonly Color Cornsilk
Field Value
Type | Description |
---|---|
Color |
Crimson
Represents a
Declaration
public static readonly Color Crimson
Field Value
Type | Description |
---|---|
Color |
Cyan
Represents a
Declaration
public static readonly Color Cyan
Field Value
Type | Description |
---|---|
Color |
DarkBlue
Represents a
Declaration
public static readonly Color DarkBlue
Field Value
Type | Description |
---|---|
Color |
DarkCyan
Represents a
Declaration
public static readonly Color DarkCyan
Field Value
Type | Description |
---|---|
Color |
DarkGoldenrod
Represents a
Declaration
public static readonly Color DarkGoldenrod
Field Value
Type | Description |
---|---|
Color |
DarkGray
Represents a
Declaration
public static readonly Color DarkGray
Field Value
Type | Description |
---|---|
Color |
DarkGreen
Represents a
Declaration
public static readonly Color DarkGreen
Field Value
Type | Description |
---|---|
Color |
DarkGrey
Represents a
Declaration
public static readonly Color DarkGrey
Field Value
Type | Description |
---|---|
Color |
DarkKhaki
Represents a
Declaration
public static readonly Color DarkKhaki
Field Value
Type | Description |
---|---|
Color |
DarkMagenta
Represents a
Declaration
public static readonly Color DarkMagenta
Field Value
Type | Description |
---|---|
Color |
DarkOliveGreen
Represents a
Declaration
public static readonly Color DarkOliveGreen
Field Value
Type | Description |
---|---|
Color |
DarkOrange
Represents a
Declaration
public static readonly Color DarkOrange
Field Value
Type | Description |
---|---|
Color |
DarkOrchid
Represents a
Declaration
public static readonly Color DarkOrchid
Field Value
Type | Description |
---|---|
Color |
DarkRed
Represents a
Declaration
public static readonly Color DarkRed
Field Value
Type | Description |
---|---|
Color |
DarkSalmon
Represents a
Declaration
public static readonly Color DarkSalmon
Field Value
Type | Description |
---|---|
Color |
DarkSeaGreen
Represents a
Declaration
public static readonly Color DarkSeaGreen
Field Value
Type | Description |
---|---|
Color |
DarkSlateBlue
Represents a
Declaration
public static readonly Color DarkSlateBlue
Field Value
Type | Description |
---|---|
Color |
DarkSlateGray
Represents a
Declaration
public static readonly Color DarkSlateGray
Field Value
Type | Description |
---|---|
Color |
DarkSlateGrey
Represents a
Declaration
public static readonly Color DarkSlateGrey
Field Value
Type | Description |
---|---|
Color |
DarkTurquoise
Represents a
Declaration
public static readonly Color DarkTurquoise
Field Value
Type | Description |
---|---|
Color |
DarkViolet
Represents a
Declaration
public static readonly Color DarkViolet
Field Value
Type | Description |
---|---|
Color |
DeepPink
Represents a
Declaration
public static readonly Color DeepPink
Field Value
Type | Description |
---|---|
Color |
DeepSkyBlue
Represents a
Declaration
public static readonly Color DeepSkyBlue
Field Value
Type | Description |
---|---|
Color |
DimGray
Represents a
Declaration
public static readonly Color DimGray
Field Value
Type | Description |
---|---|
Color |
DimGrey
Represents a
Declaration
public static readonly Color DimGrey
Field Value
Type | Description |
---|---|
Color |
DodgerBlue
Represents a
Declaration
public static readonly Color DodgerBlue
Field Value
Type | Description |
---|---|
Color |
Firebrick
Represents a
Declaration
public static readonly Color Firebrick
Field Value
Type | Description |
---|---|
Color |
FloralWhite
Represents a
Declaration
public static readonly Color FloralWhite
Field Value
Type | Description |
---|---|
Color |
ForestGreen
Represents a
Declaration
public static readonly Color ForestGreen
Field Value
Type | Description |
---|---|
Color |
Fuchsia
Represents a
Declaration
public static readonly Color Fuchsia
Field Value
Type | Description |
---|---|
Color |
Gainsboro
Represents a
Declaration
public static readonly Color Gainsboro
Field Value
Type | Description |
---|---|
Color |
GhostWhite
Represents a
Declaration
public static readonly Color GhostWhite
Field Value
Type | Description |
---|---|
Color |
Gold
Represents a
Declaration
public static readonly Color Gold
Field Value
Type | Description |
---|---|
Color |
Goldenrod
Represents a
Declaration
public static readonly Color Goldenrod
Field Value
Type | Description |
---|---|
Color |
Gray
Represents a
Declaration
public static readonly Color Gray
Field Value
Type | Description |
---|---|
Color |
Green
Represents a
Declaration
public static readonly Color Green
Field Value
Type | Description |
---|---|
Color |
GreenYellow
Represents a
Declaration
public static readonly Color GreenYellow
Field Value
Type | Description |
---|---|
Color |
Grey
Represents a
Declaration
public static readonly Color Grey
Field Value
Type | Description |
---|---|
Color |
Honeydew
Represents a
Declaration
public static readonly Color Honeydew
Field Value
Type | Description |
---|---|
Color |
HotPink
Represents a
Declaration
public static readonly Color HotPink
Field Value
Type | Description |
---|---|
Color |
IndianRed
Represents a
Declaration
public static readonly Color IndianRed
Field Value
Type | Description |
---|---|
Color |
Indigo
Represents a
Declaration
public static readonly Color Indigo
Field Value
Type | Description |
---|---|
Color |
Ivory
Represents a
Declaration
public static readonly Color Ivory
Field Value
Type | Description |
---|---|
Color |
Khaki
Represents a
Declaration
public static readonly Color Khaki
Field Value
Type | Description |
---|---|
Color |
Lavender
Represents a
Declaration
public static readonly Color Lavender
Field Value
Type | Description |
---|---|
Color |
LavenderBlush
Represents a
Declaration
public static readonly Color LavenderBlush
Field Value
Type | Description |
---|---|
Color |
LawnGreen
Represents a
Declaration
public static readonly Color LawnGreen
Field Value
Type | Description |
---|---|
Color |
LemonChiffon
Represents a
Declaration
public static readonly Color LemonChiffon
Field Value
Type | Description |
---|---|
Color |
LightBlue
Represents a
Declaration
public static readonly Color LightBlue
Field Value
Type | Description |
---|---|
Color |
LightCoral
Represents a
Declaration
public static readonly Color LightCoral
Field Value
Type | Description |
---|---|
Color |
LightCyan
Represents a
Declaration
public static readonly Color LightCyan
Field Value
Type | Description |
---|---|
Color |
LightGoldenrodYellow
Represents a
Declaration
public static readonly Color LightGoldenrodYellow
Field Value
Type | Description |
---|---|
Color |
LightGray
Represents a
Declaration
public static readonly Color LightGray
Field Value
Type | Description |
---|---|
Color |
LightGreen
Represents a
Declaration
public static readonly Color LightGreen
Field Value
Type | Description |
---|---|
Color |
LightGrey
Represents a
Declaration
public static readonly Color LightGrey
Field Value
Type | Description |
---|---|
Color |
LightPink
Represents a
Declaration
public static readonly Color LightPink
Field Value
Type | Description |
---|---|
Color |
LightSalmon
Represents a
Declaration
public static readonly Color LightSalmon
Field Value
Type | Description |
---|---|
Color |
LightSeaGreen
Represents a
Declaration
public static readonly Color LightSeaGreen
Field Value
Type | Description |
---|---|
Color |
LightSkyBlue
Represents a
Declaration
public static readonly Color LightSkyBlue
Field Value
Type | Description |
---|---|
Color |
LightSlateGray
Represents a
Declaration
public static readonly Color LightSlateGray
Field Value
Type | Description |
---|---|
Color |
LightSlateGrey
Represents a
Declaration
public static readonly Color LightSlateGrey
Field Value
Type | Description |
---|---|
Color |
LightSteelBlue
Represents a
Declaration
public static readonly Color LightSteelBlue
Field Value
Type | Description |
---|---|
Color |
LightYellow
Represents a
Declaration
public static readonly Color LightYellow
Field Value
Type | Description |
---|---|
Color |
Lime
Represents a
Declaration
public static readonly Color Lime
Field Value
Type | Description |
---|---|
Color |
LimeGreen
Represents a
Declaration
public static readonly Color LimeGreen
Field Value
Type | Description |
---|---|
Color |
Linen
Represents a
Declaration
public static readonly Color Linen
Field Value
Type | Description |
---|---|
Color |
Magenta
Represents a
Declaration
public static readonly Color Magenta
Field Value
Type | Description |
---|---|
Color |
Maroon
Represents a
Declaration
public static readonly Color Maroon
Field Value
Type | Description |
---|---|
Color |
MediumAquamarine
Represents a
Declaration
public static readonly Color MediumAquamarine
Field Value
Type | Description |
---|---|
Color |
MediumBlue
Represents a
Declaration
public static readonly Color MediumBlue
Field Value
Type | Description |
---|---|
Color |
MediumOrchid
Represents a
Declaration
public static readonly Color MediumOrchid
Field Value
Type | Description |
---|---|
Color |
MediumPurple
Represents a
Declaration
public static readonly Color MediumPurple
Field Value
Type | Description |
---|---|
Color |
MediumSeaGreen
Represents a
Declaration
public static readonly Color MediumSeaGreen
Field Value
Type | Description |
---|---|
Color |
MediumSlateBlue
Represents a
Declaration
public static readonly Color MediumSlateBlue
Field Value
Type | Description |
---|---|
Color |
MediumSpringGreen
Represents a
Declaration
public static readonly Color MediumSpringGreen
Field Value
Type | Description |
---|---|
Color |
MediumTurquoise
Represents a
Declaration
public static readonly Color MediumTurquoise
Field Value
Type | Description |
---|---|
Color |
MediumVioletRed
Represents a
Declaration
public static readonly Color MediumVioletRed
Field Value
Type | Description |
---|---|
Color |
MidnightBlue
Represents a
Declaration
public static readonly Color MidnightBlue
Field Value
Type | Description |
---|---|
Color |
MintCream
Represents a
Declaration
public static readonly Color MintCream
Field Value
Type | Description |
---|---|
Color |
MistyRose
Represents a
Declaration
public static readonly Color MistyRose
Field Value
Type | Description |
---|---|
Color |
Moccasin
Represents a
Declaration
public static readonly Color Moccasin
Field Value
Type | Description |
---|---|
Color |
NavajoWhite
Represents a
Declaration
public static readonly Color NavajoWhite
Field Value
Type | Description |
---|---|
Color |
Navy
Represents a
Declaration
public static readonly Color Navy
Field Value
Type | Description |
---|---|
Color |
OldLace
Represents a
Declaration
public static readonly Color OldLace
Field Value
Type | Description |
---|---|
Color |
Olive
Represents a
Declaration
public static readonly Color Olive
Field Value
Type | Description |
---|---|
Color |
OliveDrab
Represents a
Declaration
public static readonly Color OliveDrab
Field Value
Type | Description |
---|---|
Color |
Orange
Represents a
Declaration
public static readonly Color Orange
Field Value
Type | Description |
---|---|
Color |
OrangeRed
Represents a
Declaration
public static readonly Color OrangeRed
Field Value
Type | Description |
---|---|
Color |
Orchid
Represents a
Declaration
public static readonly Color Orchid
Field Value
Type | Description |
---|---|
Color |
PaleGoldenrod
Represents a
Declaration
public static readonly Color PaleGoldenrod
Field Value
Type | Description |
---|---|
Color |
PaleGreen
Represents a
Declaration
public static readonly Color PaleGreen
Field Value
Type | Description |
---|---|
Color |
PaleTurquoise
Represents a
Declaration
public static readonly Color PaleTurquoise
Field Value
Type | Description |
---|---|
Color |
PaleVioletRed
Represents a
Declaration
public static readonly Color PaleVioletRed
Field Value
Type | Description |
---|---|
Color |
PapayaWhip
Represents a
Declaration
public static readonly Color PapayaWhip
Field Value
Type | Description |
---|---|
Color |
PeachPuff
Represents a
Declaration
public static readonly Color PeachPuff
Field Value
Type | Description |
---|---|
Color |
Peru
Represents a
Declaration
public static readonly Color Peru
Field Value
Type | Description |
---|---|
Color |
Pink
Represents a
Declaration
public static readonly Color Pink
Field Value
Type | Description |
---|---|
Color |
Plum
Represents a
Declaration
public static readonly Color Plum
Field Value
Type | Description |
---|---|
Color |
PowderBlue
Represents a
Declaration
public static readonly Color PowderBlue
Field Value
Type | Description |
---|---|
Color |
Purple
Represents a
Declaration
public static readonly Color Purple
Field Value
Type | Description |
---|---|
Color |
RebeccaPurple
Represents a
Declaration
public static readonly Color RebeccaPurple
Field Value
Type | Description |
---|---|
Color |
Red
Represents a
Declaration
public static readonly Color Red
Field Value
Type | Description |
---|---|
Color |
RosyBrown
Represents a
Declaration
public static readonly Color RosyBrown
Field Value
Type | Description |
---|---|
Color |
RoyalBlue
Represents a
Declaration
public static readonly Color RoyalBlue
Field Value
Type | Description |
---|---|
Color |
SaddleBrown
Represents a
Declaration
public static readonly Color SaddleBrown
Field Value
Type | Description |
---|---|
Color |
Salmon
Represents a
Declaration
public static readonly Color Salmon
Field Value
Type | Description |
---|---|
Color |
SandyBrown
Represents a
Declaration
public static readonly Color SandyBrown
Field Value
Type | Description |
---|---|
Color |
SeaGreen
Represents a
Declaration
public static readonly Color SeaGreen
Field Value
Type | Description |
---|---|
Color |
SeaShell
Represents a
Declaration
public static readonly Color SeaShell
Field Value
Type | Description |
---|---|
Color |
Sienna
Represents a
Declaration
public static readonly Color Sienna
Field Value
Type | Description |
---|---|
Color |
Silver
Represents a
Declaration
public static readonly Color Silver
Field Value
Type | Description |
---|---|
Color |
SkyBlue
Represents a
Declaration
public static readonly Color SkyBlue
Field Value
Type | Description |
---|---|
Color |
SlateBlue
Represents a
Declaration
public static readonly Color SlateBlue
Field Value
Type | Description |
---|---|
Color |
SlateGray
Represents a
Declaration
public static readonly Color SlateGray
Field Value
Type | Description |
---|---|
Color |
SlateGrey
Represents a
Declaration
public static readonly Color SlateGrey
Field Value
Type | Description |
---|---|
Color |
Snow
Represents a
Declaration
public static readonly Color Snow
Field Value
Type | Description |
---|---|
Color |
SpringGreen
Represents a
Declaration
public static readonly Color SpringGreen
Field Value
Type | Description |
---|---|
Color |
SteelBlue
Represents a
Declaration
public static readonly Color SteelBlue
Field Value
Type | Description |
---|---|
Color |
Tan
Represents a
Declaration
public static readonly Color Tan
Field Value
Type | Description |
---|---|
Color |
Teal
Represents a
Declaration
public static readonly Color Teal
Field Value
Type | Description |
---|---|
Color |
Thistle
Represents a
Declaration
public static readonly Color Thistle
Field Value
Type | Description |
---|---|
Color |
Tomato
Represents a
Declaration
public static readonly Color Tomato
Field Value
Type | Description |
---|---|
Color |
Transparent
Represents a
Declaration
public static readonly Color Transparent
Field Value
Type | Description |
---|---|
Color |
Turquoise
Represents a
Declaration
public static readonly Color Turquoise
Field Value
Type | Description |
---|---|
Color |
Violet
Represents a
Declaration
public static readonly Color Violet
Field Value
Type | Description |
---|---|
Color |
Wheat
Represents a
Declaration
public static readonly Color Wheat
Field Value
Type | Description |
---|---|
Color |
White
Represents a
Declaration
public static readonly Color White
Field Value
Type | Description |
---|---|
Color |
WhiteSmoke
Represents a
Declaration
public static readonly Color WhiteSmoke
Field Value
Type | Description |
---|---|
Color |
Yellow
Represents a
Declaration
public static readonly Color Yellow
Field Value
Type | Description |
---|---|
Color |
YellowGreen
Represents a
Declaration
public static readonly Color YellowGreen
Field Value
Type | Description |
---|---|
Color |
Properties
| Improve this Doc View SourceWebSafePalette
Gets a collection of named, web safe colors as defined in the CSS Color Module Level 4.
Declaration
public static readonly ReadOnlyMemory<Color> WebSafePalette { get; }
Property Value
Type | Description |
---|---|
ReadOnlyMemory<Color> |
WernerPalette
Gets a collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821. The hex codes were collected and defined by Nicholas Rougeux https://www.c82.net/werner.
Declaration
public static readonly ReadOnlyMemory<Color> WernerPalette { get; }
Property Value
Type | Description |
---|---|
ReadOnlyMemory<Color> |
Methods
| Improve this Doc View SourceEquals(Color)
Declaration
public readonly bool Equals(Color other)
Parameters
Type | Name | Description |
---|---|---|
Color | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceFromPixel<TPixel>(TPixel)
Creates a Color from the given TPixel
.
Declaration
public static Color FromPixel<TPixel>(TPixel pixel)
where TPixel : struct, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
TPixel | pixel | The pixel to convert from. |
Returns
Type | Description |
---|---|
Color | The Color. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
FromRgb(Byte, Byte, Byte)
Creates a Color from RGB bytes.
Declaration
public static Color FromRgb(byte r, byte g, byte b)
Parameters
Type | Name | Description |
---|---|---|
Byte | r | The red component (0-255). |
Byte | g | The green component (0-255). |
Byte | b | The blue component (0-255). |
Returns
Type | Description |
---|---|
Color | The Color. |
FromRgba(Byte, Byte, Byte, Byte)
Creates a Color from RGBA bytes.
Declaration
public static Color FromRgba(byte r, byte g, byte b, byte a)
Parameters
Type | Name | Description |
---|---|---|
Byte | r | The red component (0-255). |
Byte | g | The green component (0-255). |
Byte | b | The blue component (0-255). |
Byte | a | The alpha component (0-255). |
Returns
Type | Description |
---|---|
Color | The Color. |
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceParse(String)
Creates a new instance of the Color struct from the given input string.
Declaration
public static Color Parse(string input)
Parameters
Type | Name | Description |
---|---|---|
String | input | The name of the color or the hexadecimal representation of the combined color components arranged in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax. |
Returns
Type | Description |
---|---|
Color | The Color. |
ParseHex(String)
Creates a new instance of the Color struct from the given hexadecimal string.
Declaration
public static Color ParseHex(string hex)
Parameters
Type | Name | Description |
---|---|---|
String | hex | The hexadecimal representation of the combined color components arranged in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax. |
Returns
Type | Description |
---|---|
Color | The Color. |
ToHex()
Gets the hexadecimal representation of the color instance in rrggbbaa form.
Declaration
public readonly string ToHex()
Returns
Type | Description |
---|---|
String | A hexadecimal string representation of the value. |
ToPixel<TPixel>()
Converts the color instance to a specified TPixel
type.
Declaration
public readonly TPixel ToPixel<TPixel>()
where TPixel : struct, IPixel<TPixel>
Returns
Type | Description |
---|---|
TPixel | The pixel value. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel type to convert to. |
ToPixel<TPixel>(Configuration, ReadOnlySpan<Color>, Span<TPixel>)
Bulk converts a span of Color to a span of a specified TPixel
type.
Declaration
public static void ToPixel<TPixel>(Configuration configuration, ReadOnlySpan<Color> source, Span<TPixel> destination)
where TPixel : struct, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
Configuration | configuration | The configuration. |
ReadOnlySpan<Color> | source | The source color span. |
Span<TPixel> | destination | The destination pixel span. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel type to convert to. |
ToString()
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
| Improve this Doc View SourceTryParse(String, out Color)
Attempts to creates a new instance of the Color struct from the given input string.
Declaration
public static bool TryParse(string input, out Color result)
Parameters
Type | Name | Description |
---|---|---|
String | input | The name of the color or the hexadecimal representation of the combined color components arranged in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax. |
Color | result | When this method returns, contains the Color equivalent of the hexadecimal input. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |
TryParseHex(String, out Color)
Attempts to creates a new instance of the Color struct from the given hexadecimal string.
Declaration
public static bool TryParseHex(string hex, out Color result)
Parameters
Type | Name | Description |
---|---|---|
String | hex | The hexadecimal representation of the combined color components arranged in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax. |
Color | result | When this method returns, contains the Color equivalent of the hexadecimal input. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |
WithAlpha(Single)
Alters the alpha channel of the color, returning a new instance.
Declaration
public readonly Color WithAlpha(float alpha)
Parameters
Type | Name | Description |
---|---|---|
Single | alpha | The new value of alpha [0..1]. |
Returns
Type | Description |
---|---|
Color | The color having it's alpha channel altered. |
Operators
| Improve this Doc View SourceEquality(Color, Color)
Checks whether two Color structures are equal.
Declaration
public static bool operator ==(Color left, Color right)
Parameters
Type | Name | Description |
---|---|---|
Color | left | The left hand Color operand. |
Color | right | The right hand Color operand. |
Returns
Type | Description |
---|---|
Boolean | True if the |
Explicit(Color to Vector4)
Declaration
public static explicit operator Vector4(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The Color. |
Returns
Type | Description |
---|---|
Vector4 | The Vector4. |
Explicit(Vector4 to Color)
Declaration
public static explicit operator Color(Vector4 source)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | source | The Vector4. |
Returns
Type | Description |
---|---|
Color | The Color. |
Inequality(Color, Color)
Checks whether two Color structures are not equal.
Declaration
public static bool operator !=(Color left, Color right)
Parameters
Type | Name | Description |
---|---|---|
Color | left | The left hand Color operand. |
Color | right | The right hand Color operand. |
Returns
Type | Description |
---|---|
Boolean | True if the |