Table of Contents

Struct Color

Namespace
SixLabors.ImageSharp
Assembly
SixLabors.ImageSharp.dll

Represents a color value that is convertible to any IPixel<TSelf> type.

public readonly struct Color : IEquatable<Color>
Implements
Inherited Members

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

Color(Abgr32)

Initializes a new instance of the Color struct.

public Color(Abgr32 pixel)

Parameters

pixel Abgr32

The Abgr32 containing the color information.

Color(Argb32)

Initializes a new instance of the Color struct.

public Color(Argb32 pixel)

Parameters

pixel Argb32

The Argb32 containing the color information.

Color(Bgr24)

Initializes a new instance of the Color struct.

public Color(Bgr24 pixel)

Parameters

pixel Bgr24

The Bgr24 containing the color information.

Color(Bgra32)

Initializes a new instance of the Color struct.

public Color(Bgra32 pixel)

Parameters

pixel Bgra32

The Bgra32 containing the color information.

Color(L16)

Initializes a new instance of the Color struct.

public Color(L16 pixel)

Parameters

pixel L16

The L16 containing the color information.

Color(La32)

Initializes a new instance of the Color struct.

public Color(La32 pixel)

Parameters

pixel La32

The La32 containing the color information.

Color(Rgb24)

Initializes a new instance of the Color struct.

public Color(Rgb24 pixel)

Parameters

pixel Rgb24

The Rgb24 containing the color information.

Color(Rgb48)

Initializes a new instance of the Color struct.

public Color(Rgb48 pixel)

Parameters

pixel Rgb48

The Rgb48 containing the color information.

Color(Rgba32)

Initializes a new instance of the Color struct.

public Color(Rgba32 pixel)

Parameters

pixel Rgba32

The Rgba32 containing the color information.

Color(Rgba64)

Initializes a new instance of the Color struct.

public Color(Rgba64 pixel)

Parameters

pixel Rgba64

The Rgba64 containing the color information.

Color(Vector4)

Initializes a new instance of the Color struct.

public Color(Vector4 vector)

Parameters

vector Vector4

The Vector4 containing the color information.

Fields

AliceBlue

Represents a matching the W3C definition that has an hex value of #F0F8FF.

public static readonly Color AliceBlue

Field Value

Color

AntiqueWhite

Represents a matching the W3C definition that has an hex value of #FAEBD7.

public static readonly Color AntiqueWhite

Field Value

Color

Aqua

Represents a matching the W3C definition that has an hex value of #00FFFF.

public static readonly Color Aqua

Field Value

Color

Aquamarine

Represents a matching the W3C definition that has an hex value of #7FFFD4.

public static readonly Color Aquamarine

Field Value

Color

Azure

Represents a matching the W3C definition that has an hex value of #F0FFFF.

public static readonly Color Azure

Field Value

Color

Beige

Represents a matching the W3C definition that has an hex value of #F5F5DC.

public static readonly Color Beige

Field Value

Color

Bisque

Represents a matching the W3C definition that has an hex value of #FFE4C4.

public static readonly Color Bisque

Field Value

Color

Black

Represents a matching the W3C definition that has an hex value of #000000.

public static readonly Color Black

Field Value

Color

BlanchedAlmond

Represents a matching the W3C definition that has an hex value of #FFEBCD.

public static readonly Color BlanchedAlmond

Field Value

Color

Blue

Represents a matching the W3C definition that has an hex value of #0000FF.

public static readonly Color Blue

Field Value

Color

BlueViolet

Represents a matching the W3C definition that has an hex value of #8A2BE2.

public static readonly Color BlueViolet

Field Value

Color

Brown

Represents a matching the W3C definition that has an hex value of #A52A2A.

public static readonly Color Brown

Field Value

Color

BurlyWood

Represents a matching the W3C definition that has an hex value of #DEB887.

public static readonly Color BurlyWood

Field Value

Color

CadetBlue

Represents a matching the W3C definition that has an hex value of #5F9EA0.

public static readonly Color CadetBlue

Field Value

Color

Chartreuse

Represents a matching the W3C definition that has an hex value of #7FFF00.

public static readonly Color Chartreuse

Field Value

Color

Chocolate

Represents a matching the W3C definition that has an hex value of #D2691E.

public static readonly Color Chocolate

Field Value

Color

Coral

Represents a matching the W3C definition that has an hex value of #FF7F50.

public static readonly Color Coral

Field Value

Color

CornflowerBlue

Represents a matching the W3C definition that has an hex value of #6495ED.

public static readonly Color CornflowerBlue

Field Value

Color

Cornsilk

Represents a matching the W3C definition that has an hex value of #FFF8DC.

public static readonly Color Cornsilk

Field Value

Color

Crimson

Represents a matching the W3C definition that has an hex value of #DC143C.

public static readonly Color Crimson

Field Value

Color

Cyan

Represents a matching the W3C definition that has an hex value of #00FFFF.

public static readonly Color Cyan

Field Value

Color

DarkBlue

Represents a matching the W3C definition that has an hex value of #00008B.

public static readonly Color DarkBlue

Field Value

Color

DarkCyan

Represents a matching the W3C definition that has an hex value of #008B8B.

public static readonly Color DarkCyan

Field Value

Color

DarkGoldenrod

Represents a matching the W3C definition that has an hex value of #B8860B.

public static readonly Color DarkGoldenrod

Field Value

Color

DarkGray

Represents a matching the W3C definition that has an hex value of #A9A9A9.

public static readonly Color DarkGray

Field Value

Color

DarkGreen

Represents a matching the W3C definition that has an hex value of #006400.

public static readonly Color DarkGreen

Field Value

Color

DarkGrey

Represents a matching the W3C definition that has an hex value of #A9A9A9.

public static readonly Color DarkGrey

Field Value

Color

DarkKhaki

Represents a matching the W3C definition that has an hex value of #BDB76B.

public static readonly Color DarkKhaki

Field Value

Color

DarkMagenta

Represents a matching the W3C definition that has an hex value of #8B008B.

public static readonly Color DarkMagenta

Field Value

Color

DarkOliveGreen

Represents a matching the W3C definition that has an hex value of #556B2F.

public static readonly Color DarkOliveGreen

Field Value

Color

DarkOrange

Represents a matching the W3C definition that has an hex value of #FF8C00.

public static readonly Color DarkOrange

Field Value

Color

DarkOrchid

Represents a matching the W3C definition that has an hex value of #9932CC.

public static readonly Color DarkOrchid

Field Value

Color

DarkRed

Represents a matching the W3C definition that has an hex value of #8B0000.

public static readonly Color DarkRed

Field Value

Color

DarkSalmon

Represents a matching the W3C definition that has an hex value of #E9967A.

public static readonly Color DarkSalmon

Field Value

Color

DarkSeaGreen

Represents a matching the W3C definition that has an hex value of #8FBC8F.

public static readonly Color DarkSeaGreen

Field Value

Color

DarkSlateBlue

Represents a matching the W3C definition that has an hex value of #483D8B.

public static readonly Color DarkSlateBlue

Field Value

Color

DarkSlateGray

Represents a matching the W3C definition that has an hex value of #2F4F4F.

public static readonly Color DarkSlateGray

Field Value

Color

DarkSlateGrey

Represents a matching the W3C definition that has an hex value of #2F4F4F.

public static readonly Color DarkSlateGrey

Field Value

Color

DarkTurquoise

Represents a matching the W3C definition that has an hex value of #00CED1.

public static readonly Color DarkTurquoise

Field Value

Color

DarkViolet

Represents a matching the W3C definition that has an hex value of #9400D3.

public static readonly Color DarkViolet

Field Value

Color

DeepPink

Represents a matching the W3C definition that has an hex value of #FF1493.

public static readonly Color DeepPink

Field Value

Color

DeepSkyBlue

Represents a matching the W3C definition that has an hex value of #00BFFF.

public static readonly Color DeepSkyBlue

Field Value

Color

DimGray

Represents a matching the W3C definition that has an hex value of #696969.

public static readonly Color DimGray

Field Value

Color

DimGrey

Represents a matching the W3C definition that has an hex value of #696969.

public static readonly Color DimGrey

Field Value

Color

DodgerBlue

Represents a matching the W3C definition that has an hex value of #1E90FF.

public static readonly Color DodgerBlue

Field Value

Color

Firebrick

Represents a matching the W3C definition that has an hex value of #B22222.

public static readonly Color Firebrick

Field Value

Color

FloralWhite

Represents a matching the W3C definition that has an hex value of #FFFAF0.

public static readonly Color FloralWhite

Field Value

Color

ForestGreen

Represents a matching the W3C definition that has an hex value of #228B22.

public static readonly Color ForestGreen

Field Value

Color

Fuchsia

Represents a matching the W3C definition that has an hex value of #FF00FF.

public static readonly Color Fuchsia

Field Value

Color

Gainsboro

Represents a matching the W3C definition that has an hex value of #DCDCDC.

public static readonly Color Gainsboro

Field Value

Color

GhostWhite

Represents a matching the W3C definition that has an hex value of #F8F8FF.

public static readonly Color GhostWhite

Field Value

Color

Gold

Represents a matching the W3C definition that has an hex value of #FFD700.

public static readonly Color Gold

Field Value

Color

Goldenrod

Represents a matching the W3C definition that has an hex value of #DAA520.

public static readonly Color Goldenrod

Field Value

Color

Gray

Represents a matching the W3C definition that has an hex value of #808080.

public static readonly Color Gray

Field Value

Color

Green

Represents a matching the W3C definition that has an hex value of #008000.

public static readonly Color Green

Field Value

Color

GreenYellow

Represents a matching the W3C definition that has an hex value of #ADFF2F.

public static readonly Color GreenYellow

Field Value

Color

Grey

Represents a matching the W3C definition that has an hex value of #808080.

public static readonly Color Grey

Field Value

Color

Honeydew

Represents a matching the W3C definition that has an hex value of #F0FFF0.

public static readonly Color Honeydew

Field Value

Color

HotPink

Represents a matching the W3C definition that has an hex value of #FF69B4.

public static readonly Color HotPink

Field Value

Color

IndianRed

Represents a matching the W3C definition that has an hex value of #CD5C5C.

public static readonly Color IndianRed

Field Value

Color

Indigo

Represents a matching the W3C definition that has an hex value of #4B0082.

public static readonly Color Indigo

Field Value

Color

Ivory

Represents a matching the W3C definition that has an hex value of #FFFFF0.

public static readonly Color Ivory

Field Value

Color

Khaki

Represents a matching the W3C definition that has an hex value of #F0E68C.

public static readonly Color Khaki

Field Value

Color

Lavender

Represents a matching the W3C definition that has an hex value of #E6E6FA.

public static readonly Color Lavender

Field Value

Color

LavenderBlush

Represents a matching the W3C definition that has an hex value of #FFF0F5.

public static readonly Color LavenderBlush

Field Value

Color

LawnGreen

Represents a matching the W3C definition that has an hex value of #7CFC00.

public static readonly Color LawnGreen

Field Value

Color

LemonChiffon

Represents a matching the W3C definition that has an hex value of #FFFACD.

public static readonly Color LemonChiffon

Field Value

Color

LightBlue

Represents a matching the W3C definition that has an hex value of #ADD8E6.

public static readonly Color LightBlue

Field Value

Color

LightCoral

Represents a matching the W3C definition that has an hex value of #F08080.

public static readonly Color LightCoral

Field Value

Color

LightCyan

Represents a matching the W3C definition that has an hex value of #E0FFFF.

public static readonly Color LightCyan

Field Value

Color

LightGoldenrodYellow

Represents a matching the W3C definition that has an hex value of #FAFAD2.

public static readonly Color LightGoldenrodYellow

Field Value

Color

LightGray

Represents a matching the W3C definition that has an hex value of #D3D3D3.

public static readonly Color LightGray

Field Value

Color

LightGreen

Represents a matching the W3C definition that has an hex value of #90EE90.

public static readonly Color LightGreen

Field Value

Color

LightGrey

Represents a matching the W3C definition that has an hex value of #D3D3D3.

public static readonly Color LightGrey

Field Value

Color

LightPink

Represents a matching the W3C definition that has an hex value of #FFB6C1.

public static readonly Color LightPink

Field Value

Color

LightSalmon

Represents a matching the W3C definition that has an hex value of #FFA07A.

public static readonly Color LightSalmon

Field Value

Color

LightSeaGreen

Represents a matching the W3C definition that has an hex value of #20B2AA.

public static readonly Color LightSeaGreen

Field Value

Color

LightSkyBlue

Represents a matching the W3C definition that has an hex value of #87CEFA.

public static readonly Color LightSkyBlue

Field Value

Color

LightSlateGray

Represents a matching the W3C definition that has an hex value of #778899.

public static readonly Color LightSlateGray

Field Value

Color

LightSlateGrey

Represents a matching the W3C definition that has an hex value of #778899.

public static readonly Color LightSlateGrey

Field Value

Color

LightSteelBlue

Represents a matching the W3C definition that has an hex value of #B0C4DE.

public static readonly Color LightSteelBlue

Field Value

Color

LightYellow

Represents a matching the W3C definition that has an hex value of #FFFFE0.

public static readonly Color LightYellow

Field Value

Color

Lime

Represents a matching the W3C definition that has an hex value of #00FF00.

public static readonly Color Lime

Field Value

Color

LimeGreen

Represents a matching the W3C definition that has an hex value of #32CD32.

public static readonly Color LimeGreen

Field Value

Color

Linen

Represents a matching the W3C definition that has an hex value of #FAF0E6.

public static readonly Color Linen

Field Value

Color

Magenta

Represents a matching the W3C definition that has an hex value of #FF00FF.

public static readonly Color Magenta

Field Value

Color

Maroon

Represents a matching the W3C definition that has an hex value of #800000.

public static readonly Color Maroon

Field Value

Color

MediumAquamarine

Represents a matching the W3C definition that has an hex value of #66CDAA.

public static readonly Color MediumAquamarine

Field Value

Color

MediumBlue

Represents a matching the W3C definition that has an hex value of #0000CD.

public static readonly Color MediumBlue

Field Value

Color

MediumOrchid

Represents a matching the W3C definition that has an hex value of #BA55D3.

public static readonly Color MediumOrchid

Field Value

Color

MediumPurple

Represents a matching the W3C definition that has an hex value of #9370DB.

public static readonly Color MediumPurple

Field Value

Color

MediumSeaGreen

Represents a matching the W3C definition that has an hex value of #3CB371.

public static readonly Color MediumSeaGreen

Field Value

Color

MediumSlateBlue

Represents a matching the W3C definition that has an hex value of #7B68EE.

public static readonly Color MediumSlateBlue

Field Value

Color

MediumSpringGreen

Represents a matching the W3C definition that has an hex value of #00FA9A.

public static readonly Color MediumSpringGreen

Field Value

Color

MediumTurquoise

Represents a matching the W3C definition that has an hex value of #48D1CC.

public static readonly Color MediumTurquoise

Field Value

Color

MediumVioletRed

Represents a matching the W3C definition that has an hex value of #C71585.

public static readonly Color MediumVioletRed

Field Value

Color

MidnightBlue

Represents a matching the W3C definition that has an hex value of #191970.

public static readonly Color MidnightBlue

Field Value

Color

MintCream

Represents a matching the W3C definition that has an hex value of #F5FFFA.

public static readonly Color MintCream

Field Value

Color

MistyRose

Represents a matching the W3C definition that has an hex value of #FFE4E1.

public static readonly Color MistyRose

Field Value

Color

Moccasin

Represents a matching the W3C definition that has an hex value of #FFE4B5.

public static readonly Color Moccasin

Field Value

Color

NavajoWhite

Represents a matching the W3C definition that has an hex value of #FFDEAD.

public static readonly Color NavajoWhite

Field Value

Color

Navy

Represents a matching the W3C definition that has an hex value of #000080.

public static readonly Color Navy

Field Value

Color

OldLace

Represents a matching the W3C definition that has an hex value of #FDF5E6.

public static readonly Color OldLace

Field Value

Color

Olive

Represents a matching the W3C definition that has an hex value of #808000.

public static readonly Color Olive

Field Value

Color

OliveDrab

Represents a matching the W3C definition that has an hex value of #6B8E23.

public static readonly Color OliveDrab

Field Value

Color

Orange

Represents a matching the W3C definition that has an hex value of #FFA500.

public static readonly Color Orange

Field Value

Color

OrangeRed

Represents a matching the W3C definition that has an hex value of #FF4500.

public static readonly Color OrangeRed

Field Value

Color

Orchid

Represents a matching the W3C definition that has an hex value of #DA70D6.

public static readonly Color Orchid

Field Value

Color

PaleGoldenrod

Represents a matching the W3C definition that has an hex value of #EEE8AA.

public static readonly Color PaleGoldenrod

Field Value

Color

PaleGreen

Represents a matching the W3C definition that has an hex value of #98FB98.

public static readonly Color PaleGreen

Field Value

Color

PaleTurquoise

Represents a matching the W3C definition that has an hex value of #AFEEEE.

public static readonly Color PaleTurquoise

Field Value

Color

PaleVioletRed

Represents a matching the W3C definition that has an hex value of #DB7093.

public static readonly Color PaleVioletRed

Field Value

Color

PapayaWhip

Represents a matching the W3C definition that has an hex value of #FFEFD5.

public static readonly Color PapayaWhip

Field Value

Color

PeachPuff

Represents a matching the W3C definition that has an hex value of #FFDAB9.

public static readonly Color PeachPuff

Field Value

Color

Peru

Represents a matching the W3C definition that has an hex value of #CD853F.

public static readonly Color Peru

Field Value

Color

Pink

Represents a matching the W3C definition that has an hex value of #FFC0CB.

public static readonly Color Pink

Field Value

Color

Plum

Represents a matching the W3C definition that has an hex value of #DDA0DD.

public static readonly Color Plum

Field Value

Color

PowderBlue

Represents a matching the W3C definition that has an hex value of #B0E0E6.

public static readonly Color PowderBlue

Field Value

Color

Purple

Represents a matching the W3C definition that has an hex value of #800080.

public static readonly Color Purple

Field Value

Color

RebeccaPurple

Represents a matching the W3C definition that has an hex value of #663399.

public static readonly Color RebeccaPurple

Field Value

Color

Red

Represents a matching the W3C definition that has an hex value of #FF0000.

public static readonly Color Red

Field Value

Color

RosyBrown

Represents a matching the W3C definition that has an hex value of #BC8F8F.

public static readonly Color RosyBrown

Field Value

Color

RoyalBlue

Represents a matching the W3C definition that has an hex value of #4169E1.

public static readonly Color RoyalBlue

Field Value

Color

SaddleBrown

Represents a matching the W3C definition that has an hex value of #8B4513.

public static readonly Color SaddleBrown

Field Value

Color

Salmon

Represents a matching the W3C definition that has an hex value of #FA8072.

public static readonly Color Salmon

Field Value

Color

SandyBrown

Represents a matching the W3C definition that has an hex value of #F4A460.

public static readonly Color SandyBrown

Field Value

Color

SeaGreen

Represents a matching the W3C definition that has an hex value of #2E8B57.

public static readonly Color SeaGreen

Field Value

Color

SeaShell

Represents a matching the W3C definition that has an hex value of #FFF5EE.

public static readonly Color SeaShell

Field Value

Color

Sienna

Represents a matching the W3C definition that has an hex value of #A0522D.

public static readonly Color Sienna

Field Value

Color

Silver

Represents a matching the W3C definition that has an hex value of #C0C0C0.

public static readonly Color Silver

Field Value

Color

SkyBlue

Represents a matching the W3C definition that has an hex value of #87CEEB.

public static readonly Color SkyBlue

Field Value

Color

SlateBlue

Represents a matching the W3C definition that has an hex value of #6A5ACD.

public static readonly Color SlateBlue

Field Value

Color

SlateGray

Represents a matching the W3C definition that has an hex value of #708090.

public static readonly Color SlateGray

Field Value

Color

SlateGrey

Represents a matching the W3C definition that has an hex value of #708090.

public static readonly Color SlateGrey

Field Value

Color

Snow

Represents a matching the W3C definition that has an hex value of #FFFAFA.

public static readonly Color Snow

Field Value

Color

SpringGreen

Represents a matching the W3C definition that has an hex value of #00FF7F.

public static readonly Color SpringGreen

Field Value

Color

SteelBlue

Represents a matching the W3C definition that has an hex value of #4682B4.

public static readonly Color SteelBlue

Field Value

Color

Tan

Represents a matching the W3C definition that has an hex value of #D2B48C.

public static readonly Color Tan

Field Value

Color

Teal

Represents a matching the W3C definition that has an hex value of #008080.

public static readonly Color Teal

Field Value

Color

Thistle

Represents a matching the W3C definition that has an hex value of #D8BFD8.

public static readonly Color Thistle

Field Value

Color

Tomato

Represents a matching the W3C definition that has an hex value of #FF6347.

public static readonly Color Tomato

Field Value

Color

Transparent

Represents a matching the W3C definition that has an hex value of #00000000.

public static readonly Color Transparent

Field Value

Color

Turquoise

Represents a matching the W3C definition that has an hex value of #40E0D0.

public static readonly Color Turquoise

Field Value

Color

Violet

Represents a matching the W3C definition that has an hex value of #EE82EE.

public static readonly Color Violet

Field Value

Color

Wheat

Represents a matching the W3C definition that has an hex value of #F5DEB3.

public static readonly Color Wheat

Field Value

Color

White

Represents a matching the W3C definition that has an hex value of #FFFFFF.

public static readonly Color White

Field Value

Color

WhiteSmoke

Represents a matching the W3C definition that has an hex value of #F5F5F5.

public static readonly Color WhiteSmoke

Field Value

Color

Yellow

Represents a matching the W3C definition that has an hex value of #FFFF00.

public static readonly Color Yellow

Field Value

Color

YellowGreen

Represents a matching the W3C definition that has an hex value of #9ACD32.

public static readonly Color YellowGreen

Field Value

Color

Properties

WebSafePalette

Gets a collection of named, web safe colors as defined in the CSS Color Module Level 4.

public static ReadOnlyMemory<Color> WebSafePalette { get; }

Property Value

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.

public static ReadOnlyMemory<Color> WernerPalette { get; }

Property Value

ReadOnlyMemory<Color>

Methods

Equals(Color)

public bool Equals(Color other)

Parameters

other Color

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromPixel<TPixel>(TPixel)

Creates a Color from the given TPixel.

public static Color FromPixel<TPixel>(TPixel pixel) where TPixel : unmanaged, IPixel<TPixel>

Parameters

pixel TPixel

The pixel to convert from.

Returns

Color

The Color.

Type Parameters

TPixel

The pixel format.

FromRgb(byte, byte, byte)

Creates a Color from RGB bytes.

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

Parameters

r byte

The red component (0-255).

g byte

The green component (0-255).

b byte

The blue component (0-255).

Returns

Color

The Color.

FromRgba(byte, byte, byte, byte)

Creates a Color from RGBA bytes.

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

Parameters

r byte

The red component (0-255).

g byte

The green component (0-255).

b byte

The blue component (0-255).

a byte

The alpha component (0-255).

Returns

Color

The Color.

GetHashCode()

public override int GetHashCode()

Returns

int

Parse(string)

Creates a new instance of the Color struct from the given input string.

public static Color Parse(string input)

Parameters

input string

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

Color

The Color.

Exceptions

ArgumentException

Input string is not in the correct format.

ParseHex(string)

Creates a new instance of the Color struct from the given hexadecimal string.

public static Color ParseHex(string hex)

Parameters

hex string

The hexadecimal representation of the combined color components arranged in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax.

Returns

Color

The Color.

ToHex()

Gets the hexadecimal representation of the color instance in rrggbbaa form.

public string ToHex()

Returns

string

A hexadecimal string representation of the value.

ToPixel<TPixel>()

Converts the color instance to a specified TPixel type.

public TPixel ToPixel<TPixel>() where TPixel : unmanaged, IPixel<TPixel>

Returns

TPixel

The pixel value.

Type Parameters

TPixel

The pixel type to convert to.

ToPixel<TPixel>(ReadOnlySpan<Color>, Span<TPixel>)

Bulk converts a span of Color to a span of a specified TPixel type.

public static void ToPixel<TPixel>(ReadOnlySpan<Color> source, Span<TPixel> destination) where TPixel : unmanaged, IPixel<TPixel>

Parameters

source ReadOnlySpan<Color>

The source color span.

destination Span<TPixel>

The destination pixel span.

Type Parameters

TPixel

The pixel type to convert to.

ToString()

public override string ToString()

Returns

string

TryParse(string, out Color)

Attempts to creates a new instance of the Color struct from the given input string.

public static bool TryParse(string input, out Color result)

Parameters

input string

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.

result Color

When this method returns, contains the Color equivalent of the hexadecimal input.

Returns

bool

The bool.

TryParseHex(string, out Color)

Attempts to creates a new instance of the Color struct from the given hexadecimal string.

public static bool TryParseHex(string hex, out Color result)

Parameters

hex string

The hexadecimal representation of the combined color components arranged in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax.

result Color

When this method returns, contains the Color equivalent of the hexadecimal input.

Returns

bool

The bool.

WithAlpha(float)

Alters the alpha channel of the color, returning a new instance.

public Color WithAlpha(float alpha)

Parameters

alpha float

The new value of alpha [0..1].

Returns

Color

The color having it's alpha channel altered.

Operators

operator ==(Color, Color)

Checks whether two Color structures are equal.

public static bool operator ==(Color left, Color right)

Parameters

left Color

The left hand Color operand.

right Color

The right hand Color operand.

Returns

bool

True if the left parameter is equal to the right parameter; otherwise, false.

explicit operator Vector4(Color)

Converts a Color to Vector4.

public static explicit operator Vector4(Color color)

Parameters

color Color

The Color.

Returns

Vector4

The Vector4.

explicit operator Color(Vector4)

Converts an Vector4 to Color.

public static explicit operator Color(Vector4 source)

Parameters

source Vector4

The Vector4.

Returns

Color

The Color.

operator !=(Color, Color)

Checks whether two Color structures are not equal.

public static bool operator !=(Color left, Color right)

Parameters

left Color

The left hand Color operand.

right Color

The right hand Color operand.

Returns

bool

True if the left parameter is not equal to the right parameter; otherwise, false.