• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Struct Color

Represents an ARGB color, mirroring the System.Drawing.Color API.

Implements
IEquatable<Color>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: DRIT.Drawing.Colors
Assembly: DRIT.Drawing.dll
Syntax
public readonly struct Color : IEquatable<Color>

Fields

Empty

Gets a Color structure that has ARGB values of (0, 0, 0, 0).

Declaration
public static readonly Color Empty
Field Value
Type Description
Color

Properties

A

Gets the alpha channel component of this Color structure.

Declaration
public byte A { get; }
Property Value
Type Description
byte

AliceBlue

Gets a Color representing AliceBlue.

Declaration
public static Color AliceBlue { get; }
Property Value
Type Description
Color

AntiqueWhite

Gets a Color representing AntiqueWhite.

Declaration
public static Color AntiqueWhite { get; }
Property Value
Type Description
Color

Aqua

Gets a Color representing Aqua.

Declaration
public static Color Aqua { get; }
Property Value
Type Description
Color

Aquamarine

Gets a Color representing Aquamarine.

Declaration
public static Color Aquamarine { get; }
Property Value
Type Description
Color

Azure

Gets a Color representing Azure.

Declaration
public static Color Azure { get; }
Property Value
Type Description
Color

B

Gets the blue channel component of this Color structure.

Declaration
public byte B { get; }
Property Value
Type Description
byte

Beige

Gets a Color representing Beige.

Declaration
public static Color Beige { get; }
Property Value
Type Description
Color

Bisque

Gets a Color representing Bisque.

Declaration
public static Color Bisque { get; }
Property Value
Type Description
Color

Black

Gets a Color representing Black.

Declaration
public static Color Black { get; }
Property Value
Type Description
Color

BlanchedAlmond

Gets a Color representing BlanchedAlmond.

Declaration
public static Color BlanchedAlmond { get; }
Property Value
Type Description
Color

Blue

Gets a Color representing Blue.

Declaration
public static Color Blue { get; }
Property Value
Type Description
Color

BlueViolet

Gets a Color representing BlueViolet.

Declaration
public static Color BlueViolet { get; }
Property Value
Type Description
Color

Brown

Gets a Color representing Brown.

Declaration
public static Color Brown { get; }
Property Value
Type Description
Color

BurlyWood

Gets a Color representing BurlyWood.

Declaration
public static Color BurlyWood { get; }
Property Value
Type Description
Color

CadetBlue

Gets a Color representing CadetBlue.

Declaration
public static Color CadetBlue { get; }
Property Value
Type Description
Color

Chartreuse

Gets a Color representing Chartreuse.

Declaration
public static Color Chartreuse { get; }
Property Value
Type Description
Color

Chocolate

Gets a Color representing Chocolate.

Declaration
public static Color Chocolate { get; }
Property Value
Type Description
Color

Coral

Gets a Color representing Coral.

Declaration
public static Color Coral { get; }
Property Value
Type Description
Color

CornflowerBlue

Gets a Color representing CornflowerBlue.

Declaration
public static Color CornflowerBlue { get; }
Property Value
Type Description
Color

Cornsilk

Gets a Color representing Cornsilk.

Declaration
public static Color Cornsilk { get; }
Property Value
Type Description
Color

Crimson

Gets a Color representing Crimson.

Declaration
public static Color Crimson { get; }
Property Value
Type Description
Color

Cyan

Gets a Color representing Cyan.

Declaration
public static Color Cyan { get; }
Property Value
Type Description
Color

DarkBlue

Gets a Color representing DarkBlue.

Declaration
public static Color DarkBlue { get; }
Property Value
Type Description
Color

DarkCyan

Gets a Color representing DarkCyan.

Declaration
public static Color DarkCyan { get; }
Property Value
Type Description
Color

DarkGoldenrod

Gets a Color representing DarkGoldenrod.

Declaration
public static Color DarkGoldenrod { get; }
Property Value
Type Description
Color

DarkGray

Gets a Color representing DarkGray.

Declaration
public static Color DarkGray { get; }
Property Value
Type Description
Color

DarkGreen

Gets a Color representing DarkGreen.

Declaration
public static Color DarkGreen { get; }
Property Value
Type Description
Color

DarkKhaki

Gets a Color representing DarkKhaki.

Declaration
public static Color DarkKhaki { get; }
Property Value
Type Description
Color

DarkMagenta

Gets a Color representing DarkMagenta.

Declaration
public static Color DarkMagenta { get; }
Property Value
Type Description
Color

DarkOliveGreen

Gets a Color representing DarkOliveGreen.

Declaration
public static Color DarkOliveGreen { get; }
Property Value
Type Description
Color

DarkOrange

Gets a Color representing DarkOrange.

Declaration
public static Color DarkOrange { get; }
Property Value
Type Description
Color

DarkOrchid

Gets a Color representing DarkOrchid.

Declaration
public static Color DarkOrchid { get; }
Property Value
Type Description
Color

DarkRed

Gets a Color representing DarkRed.

Declaration
public static Color DarkRed { get; }
Property Value
Type Description
Color

DarkSalmon

Gets a Color representing DarkSalmon.

Declaration
public static Color DarkSalmon { get; }
Property Value
Type Description
Color

DarkSeaGreen

Gets a Color representing DarkSeaGreen.

Declaration
public static Color DarkSeaGreen { get; }
Property Value
Type Description
Color

DarkSlateBlue

Gets a Color representing DarkSlateBlue.

Declaration
public static Color DarkSlateBlue { get; }
Property Value
Type Description
Color

DarkSlateGray

Gets a Color representing DarkSlateGray.

Declaration
public static Color DarkSlateGray { get; }
Property Value
Type Description
Color

DarkTurquoise

Gets a Color representing DarkTurquoise.

Declaration
public static Color DarkTurquoise { get; }
Property Value
Type Description
Color

DarkViolet

Gets a Color representing DarkViolet.

Declaration
public static Color DarkViolet { get; }
Property Value
Type Description
Color

DeepPink

Gets a Color representing DeepPink.

Declaration
public static Color DeepPink { get; }
Property Value
Type Description
Color

DeepSkyBlue

Gets a Color representing DeepSkyBlue.

Declaration
public static Color DeepSkyBlue { get; }
Property Value
Type Description
Color

DimGray

Gets a Color representing DimGray.

Declaration
public static Color DimGray { get; }
Property Value
Type Description
Color

DodgerBlue

Gets a Color representing DodgerBlue.

Declaration
public static Color DodgerBlue { get; }
Property Value
Type Description
Color

Firebrick

Gets a Color representing Firebrick.

Declaration
public static Color Firebrick { get; }
Property Value
Type Description
Color

FloralWhite

Gets a Color representing FloralWhite.

Declaration
public static Color FloralWhite { get; }
Property Value
Type Description
Color

ForestGreen

Gets a Color representing ForestGreen.

Declaration
public static Color ForestGreen { get; }
Property Value
Type Description
Color

Fuchsia

Gets a Color representing Fuchsia.

Declaration
public static Color Fuchsia { get; }
Property Value
Type Description
Color

G

Gets the green channel component of this Color structure.

Declaration
public byte G { get; }
Property Value
Type Description
byte

Gainsboro

Gets a Color representing Gainsboro.

Declaration
public static Color Gainsboro { get; }
Property Value
Type Description
Color

GhostWhite

Gets a Color representing GhostWhite.

Declaration
public static Color GhostWhite { get; }
Property Value
Type Description
Color

Gold

Gets a Color representing Gold.

Declaration
public static Color Gold { get; }
Property Value
Type Description
Color

Goldenrod

Gets a Color representing Goldenrod.

Declaration
public static Color Goldenrod { get; }
Property Value
Type Description
Color

Gray

Gets a Color representing Gray.

Declaration
public static Color Gray { get; }
Property Value
Type Description
Color

Green

Gets a Color representing Green.

Declaration
public static Color Green { get; }
Property Value
Type Description
Color

GreenYellow

Gets a Color representing GreenYellow.

Declaration
public static Color GreenYellow { get; }
Property Value
Type Description
Color

Honeydew

Gets a Color representing Honeydew.

Declaration
public static Color Honeydew { get; }
Property Value
Type Description
Color

HotPink

Gets a Color representing HotPink.

Declaration
public static Color HotPink { get; }
Property Value
Type Description
Color

IndianRed

Gets a Color representing IndianRed.

Declaration
public static Color IndianRed { get; }
Property Value
Type Description
Color

Indigo

Gets a Color representing Indigo.

Declaration
public static Color Indigo { get; }
Property Value
Type Description
Color

IsEmpty

Gets a value indicating whether this Color is empty.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
bool

IsKnownColor

Gets a value indicating whether this Color is a known color.

Declaration
public bool IsKnownColor { get; }
Property Value
Type Description
bool

IsNamedColor

Gets a value indicating whether this Color is a named color.

Declaration
public bool IsNamedColor { get; }
Property Value
Type Description
bool

IsSystemColor

Gets a value indicating whether this Color is a system color.

Declaration
public bool IsSystemColor { get; }
Property Value
Type Description
bool

Ivory

Gets a Color representing Ivory.

Declaration
public static Color Ivory { get; }
Property Value
Type Description
Color

Khaki

Gets a Color representing Khaki.

Declaration
public static Color Khaki { get; }
Property Value
Type Description
Color

Lavender

Gets a Color representing Lavender.

Declaration
public static Color Lavender { get; }
Property Value
Type Description
Color

LavenderBlush

Gets a Color representing LavenderBlush.

Declaration
public static Color LavenderBlush { get; }
Property Value
Type Description
Color

LawnGreen

Gets a Color representing LawnGreen.

Declaration
public static Color LawnGreen { get; }
Property Value
Type Description
Color

LemonChiffon

Gets a Color representing LemonChiffon.

Declaration
public static Color LemonChiffon { get; }
Property Value
Type Description
Color

LightBlue

Gets a Color representing LightBlue.

Declaration
public static Color LightBlue { get; }
Property Value
Type Description
Color

LightCoral

Gets a Color representing LightCoral.

Declaration
public static Color LightCoral { get; }
Property Value
Type Description
Color

LightCyan

Gets a Color representing LightCyan.

Declaration
public static Color LightCyan { get; }
Property Value
Type Description
Color

LightGoldenrodYellow

Gets a Color representing LightGoldenrodYellow.

Declaration
public static Color LightGoldenrodYellow { get; }
Property Value
Type Description
Color

LightGray

Gets a Color representing LightGray.

Declaration
public static Color LightGray { get; }
Property Value
Type Description
Color

LightGreen

Gets a Color representing LightGreen.

Declaration
public static Color LightGreen { get; }
Property Value
Type Description
Color

LightPink

Gets a Color representing LightPink.

Declaration
public static Color LightPink { get; }
Property Value
Type Description
Color

LightSalmon

Gets a Color representing LightSalmon.

Declaration
public static Color LightSalmon { get; }
Property Value
Type Description
Color

LightSeaGreen

Gets a Color representing LightSeaGreen.

Declaration
public static Color LightSeaGreen { get; }
Property Value
Type Description
Color

LightSkyBlue

Gets a Color representing LightSkyBlue.

Declaration
public static Color LightSkyBlue { get; }
Property Value
Type Description
Color

LightSlateGray

Gets a Color representing LightSlateGray.

Declaration
public static Color LightSlateGray { get; }
Property Value
Type Description
Color

LightSteelBlue

Gets a Color representing LightSteelBlue.

Declaration
public static Color LightSteelBlue { get; }
Property Value
Type Description
Color

LightYellow

Gets a Color representing LightYellow.

Declaration
public static Color LightYellow { get; }
Property Value
Type Description
Color

Lime

Gets a Color representing Lime.

Declaration
public static Color Lime { get; }
Property Value
Type Description
Color

LimeGreen

Gets a Color representing LimeGreen.

Declaration
public static Color LimeGreen { get; }
Property Value
Type Description
Color

Linen

Gets a Color representing Linen.

Declaration
public static Color Linen { get; }
Property Value
Type Description
Color

Magenta

Gets a Color representing Magenta.

Declaration
public static Color Magenta { get; }
Property Value
Type Description
Color

Maroon

Gets a Color representing Maroon.

Declaration
public static Color Maroon { get; }
Property Value
Type Description
Color

MediumAquamarine

Gets a Color representing MediumAquamarine.

Declaration
public static Color MediumAquamarine { get; }
Property Value
Type Description
Color

MediumBlue

Gets a Color representing MediumBlue.

Declaration
public static Color MediumBlue { get; }
Property Value
Type Description
Color

MediumOrchid

Gets a Color representing MediumOrchid.

Declaration
public static Color MediumOrchid { get; }
Property Value
Type Description
Color

MediumPurple

Gets a Color representing MediumPurple.

Declaration
public static Color MediumPurple { get; }
Property Value
Type Description
Color

MediumSeaGreen

Gets a Color representing MediumSeaGreen.

Declaration
public static Color MediumSeaGreen { get; }
Property Value
Type Description
Color

MediumSlateBlue

Gets a Color representing MediumSlateBlue.

Declaration
public static Color MediumSlateBlue { get; }
Property Value
Type Description
Color

MediumSpringGreen

Gets a Color representing MediumSpringGreen.

Declaration
public static Color MediumSpringGreen { get; }
Property Value
Type Description
Color

MediumTurquoise

Gets a Color representing MediumTurquoise.

Declaration
public static Color MediumTurquoise { get; }
Property Value
Type Description
Color

MediumVioletRed

Gets a Color representing MediumVioletRed.

Declaration
public static Color MediumVioletRed { get; }
Property Value
Type Description
Color

MidnightBlue

Gets a Color representing MidnightBlue.

Declaration
public static Color MidnightBlue { get; }
Property Value
Type Description
Color

MintCream

Gets a Color representing MintCream.

Declaration
public static Color MintCream { get; }
Property Value
Type Description
Color

MistyRose

Gets a Color representing MistyRose.

Declaration
public static Color MistyRose { get; }
Property Value
Type Description
Color

Moccasin

Gets a Color representing Moccasin.

Declaration
public static Color Moccasin { get; }
Property Value
Type Description
Color

Name

Gets the name of this Color.

Declaration
public string Name { get; }
Property Value
Type Description
string

NavajoWhite

Gets a Color representing NavajoWhite.

Declaration
public static Color NavajoWhite { get; }
Property Value
Type Description
Color

Navy

Gets a Color representing Navy.

Declaration
public static Color Navy { get; }
Property Value
Type Description
Color

OldLace

Gets a Color representing OldLace.

Declaration
public static Color OldLace { get; }
Property Value
Type Description
Color

Olive

Gets a Color representing Olive.

Declaration
public static Color Olive { get; }
Property Value
Type Description
Color

OliveDrab

Gets a Color representing OliveDrab.

Declaration
public static Color OliveDrab { get; }
Property Value
Type Description
Color

Orange

Gets a Color representing Orange.

Declaration
public static Color Orange { get; }
Property Value
Type Description
Color

OrangeRed

Gets a Color representing OrangeRed.

Declaration
public static Color OrangeRed { get; }
Property Value
Type Description
Color

Orchid

Gets a Color representing Orchid.

Declaration
public static Color Orchid { get; }
Property Value
Type Description
Color

PaleGoldenrod

Gets a Color representing PaleGoldenrod.

Declaration
public static Color PaleGoldenrod { get; }
Property Value
Type Description
Color

PaleGreen

Gets a Color representing PaleGreen.

Declaration
public static Color PaleGreen { get; }
Property Value
Type Description
Color

PaleTurquoise

Gets a Color representing PaleTurquoise.

Declaration
public static Color PaleTurquoise { get; }
Property Value
Type Description
Color

PaleVioletRed

Gets a Color representing PaleVioletRed.

Declaration
public static Color PaleVioletRed { get; }
Property Value
Type Description
Color

PapayaWhip

Gets a Color representing PapayaWhip.

Declaration
public static Color PapayaWhip { get; }
Property Value
Type Description
Color

PeachPuff

Gets a Color representing PeachPuff.

Declaration
public static Color PeachPuff { get; }
Property Value
Type Description
Color

Peru

Gets a Color representing Peru.

Declaration
public static Color Peru { get; }
Property Value
Type Description
Color

Pink

Gets a Color representing Pink.

Declaration
public static Color Pink { get; }
Property Value
Type Description
Color

Plum

Gets a Color representing Plum.

Declaration
public static Color Plum { get; }
Property Value
Type Description
Color

PowderBlue

Gets a Color representing PowderBlue.

Declaration
public static Color PowderBlue { get; }
Property Value
Type Description
Color

Purple

Gets a Color representing Purple.

Declaration
public static Color Purple { get; }
Property Value
Type Description
Color

R

Gets the red channel component of this Color structure.

Declaration
public byte R { get; }
Property Value
Type Description
byte

Red

Gets a Color representing Red.

Declaration
public static Color Red { get; }
Property Value
Type Description
Color

RosyBrown

Gets a Color representing RosyBrown.

Declaration
public static Color RosyBrown { get; }
Property Value
Type Description
Color

RoyalBlue

Gets a Color representing RoyalBlue.

Declaration
public static Color RoyalBlue { get; }
Property Value
Type Description
Color

SaddleBrown

Gets a Color representing SaddleBrown.

Declaration
public static Color SaddleBrown { get; }
Property Value
Type Description
Color

Salmon

Gets a Color representing Salmon.

Declaration
public static Color Salmon { get; }
Property Value
Type Description
Color

SandyBrown

Gets a Color representing SandyBrown.

Declaration
public static Color SandyBrown { get; }
Property Value
Type Description
Color

SeaGreen

Gets a Color representing SeaGreen.

Declaration
public static Color SeaGreen { get; }
Property Value
Type Description
Color

SeaShell

Gets a Color representing SeaShell.

Declaration
public static Color SeaShell { get; }
Property Value
Type Description
Color

Sienna

Gets a Color representing Sienna.

Declaration
public static Color Sienna { get; }
Property Value
Type Description
Color

Silver

Gets a Color representing Silver.

Declaration
public static Color Silver { get; }
Property Value
Type Description
Color

SkyBlue

Gets a Color representing SkyBlue.

Declaration
public static Color SkyBlue { get; }
Property Value
Type Description
Color

SlateBlue

Gets a Color representing SlateBlue.

Declaration
public static Color SlateBlue { get; }
Property Value
Type Description
Color

SlateGray

Gets a Color representing SlateGray.

Declaration
public static Color SlateGray { get; }
Property Value
Type Description
Color

Snow

Gets a Color representing Snow.

Declaration
public static Color Snow { get; }
Property Value
Type Description
Color

SpringGreen

Gets a Color representing SpringGreen.

Declaration
public static Color SpringGreen { get; }
Property Value
Type Description
Color

SteelBlue

Gets a Color representing SteelBlue.

Declaration
public static Color SteelBlue { get; }
Property Value
Type Description
Color

Tan

Gets a Color representing Tan.

Declaration
public static Color Tan { get; }
Property Value
Type Description
Color

Teal

Gets a Color representing Teal.

Declaration
public static Color Teal { get; }
Property Value
Type Description
Color

Thistle

Gets a Color representing Thistle.

Declaration
public static Color Thistle { get; }
Property Value
Type Description
Color

Tomato

Gets a Color representing Tomato.

Declaration
public static Color Tomato { get; }
Property Value
Type Description
Color

Transparent

Gets a Color representing transparent (ARGB = 0x00FFFFFF).

Declaration
public static Color Transparent { get; }
Property Value
Type Description
Color

Turquoise

Gets a Color representing Turquoise.

Declaration
public static Color Turquoise { get; }
Property Value
Type Description
Color

Violet

Gets a Color representing Violet.

Declaration
public static Color Violet { get; }
Property Value
Type Description
Color

Wheat

Gets a Color representing Wheat.

Declaration
public static Color Wheat { get; }
Property Value
Type Description
Color

White

Gets a Color representing White.

Declaration
public static Color White { get; }
Property Value
Type Description
Color

WhiteSmoke

Gets a Color representing WhiteSmoke.

Declaration
public static Color WhiteSmoke { get; }
Property Value
Type Description
Color

Yellow

Gets a Color representing Yellow.

Declaration
public static Color Yellow { get; }
Property Value
Type Description
Color

YellowGreen

Gets a Color representing YellowGreen.

Declaration
public static Color YellowGreen { get; }
Property Value
Type Description
Color

Methods

Equals(Color)

Indicates whether this Color is equal to another Color.

Declaration
public bool Equals(Color other)
Parameters
Type Name Description
Color other

The color to compare with.

Returns
Type Description
bool

True if the colors are equal; otherwise, false.

Equals(object?)

Indicates whether this Color is equal to the specified object.

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj

The object to compare with.

Returns
Type Description
bool

True if the colors are equal; otherwise, false.

Overrides
ValueType.Equals(object)

FromArgb(int)

Creates a Color from a 32-bit ARGB value.

Declaration
public static Color FromArgb(int argb)
Parameters
Type Name Description
int argb

A 32-bit ARGB value.

Returns
Type Description
Color

A Color structure.

FromArgb(int, Color)

Creates a Color from the specified alpha and base color.

Declaration
public static Color FromArgb(int alpha, Color baseColor)
Parameters
Type Name Description
int alpha

The alpha channel value (0-255).

Color baseColor

The base color to use for RGB components.

Returns
Type Description
Color

A Color structure.

FromArgb(int, int, int)

Creates a Color from the specified RGB component values with full opacity.

Declaration
public static Color FromArgb(int red, int green, int blue)
Parameters
Type Name Description
int red

The red channel value (0-255).

int green

The green channel value (0-255).

int blue

The blue channel value (0-255).

Returns
Type Description
Color

A Color structure.

FromArgb(int, int, int, int)

Creates a Color from the specified ARGB component values.

Declaration
public static Color FromArgb(int alpha, int red, int green, int blue)
Parameters
Type Name Description
int alpha

The alpha channel value (0-255).

int red

The red channel value (0-255).

int green

The green channel value (0-255).

int blue

The blue channel value (0-255).

Returns
Type Description
Color

A Color structure.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when any component is outside 0-255.

FromKnownColor(KnownColor)

Creates a Color from the specified known color.

Declaration
public static Color FromKnownColor(KnownColor color)
Parameters
Type Name Description
KnownColor color

The known color to create.

Returns
Type Description
Color

A Color structure.

FromName(string)

Creates a Color from the specified color name.

Declaration
public static Color FromName(string name)
Parameters
Type Name Description
string name

The name of the color.

Returns
Type Description
Color

A Color structure.

GetBrightness()

Gets the brightness (lightness) component of this Color (0.0-1.0).

Declaration
public float GetBrightness()
Returns
Type Description
float

The brightness value.

GetHashCode()

Gets the hash code for this Color.

Declaration
public override int GetHashCode()
Returns
Type Description
int

The hash code.

Overrides
ValueType.GetHashCode()

GetHue()

Gets the hue component of this Color, in degrees (0-360).

Declaration
public float GetHue()
Returns
Type Description
float

The hue value in degrees.

GetSaturation()

Gets the saturation component of this Color (0.0-1.0).

Declaration
public float GetSaturation()
Returns
Type Description
float

The saturation value.

ToArgb()

Gets the 32-bit ARGB value of this Color.

Declaration
public int ToArgb()
Returns
Type Description
int

A 32-bit ARGB value.

ToKnownColor()

Gets the KnownColor value of this Color.

Declaration
public KnownColor ToKnownColor()
Returns
Type Description
KnownColor

The known color value.

ToString()

Converts this Color to its string representation.

Declaration
public override string ToString()
Returns
Type Description
string

A string representation of the color.

Overrides
ValueType.ToString()

Operators

operator ==(Color, Color)

Determines whether two Color structures are equal.

Declaration
public static bool operator ==(Color left, Color right)
Parameters
Type Name Description
Color left

The first color.

Color right

The second color.

Returns
Type Description
bool

True if the colors are equal; otherwise, false.

operator !=(Color, Color)

Determines whether two Color structures are not equal.

Declaration
public static bool operator !=(Color left, Color right)
Parameters
Type Name Description
Color left

The first color.

Color right

The second color.

Returns
Type Description
bool

True if the colors are not equal; otherwise, false.

Implements

IEquatable<T>
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX