Table of Contents

Struct Color

Namespace
SharpConsoleUI
Assembly
SharpConsoleUI.dll

Represents a 24-bit RGB color. Drop-in replacement for Spectre.Console.Color with identical constructor, property, and named-color API surface.

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

Constructors

Color(byte, byte, byte, byte)

Creates a color from RGB components.

public Color(byte r, byte g, byte b, byte a = 255)

Parameters

r byte
g byte
b byte
a byte

Properties

A

Alpha component (0 = fully transparent, 255 = fully opaque).

public byte A { get; }

Property Value

byte

Aqua

public static Color Aqua { get; }

Property Value

Color

Aquamarine1

public static Color Aquamarine1 { get; }

Property Value

Color

Aquamarine1_1

public static Color Aquamarine1_1 { get; }

Property Value

Color

Aquamarine3

public static Color Aquamarine3 { get; }

Property Value

Color

B

RGB blue component (0-255).

public byte B { get; }

Property Value

byte

Black

public static Color Black { get; }

Property Value

Color

Blue

public static Color Blue { get; }

Property Value

Color

Blue1

public static Color Blue1 { get; }

Property Value

Color

Blue3

public static Color Blue3 { get; }

Property Value

Color

Blue3_1

public static Color Blue3_1 { get; }

Property Value

Color

BlueViolet

public static Color BlueViolet { get; }

Property Value

Color

CadetBlue

public static Color CadetBlue { get; }

Property Value

Color

CadetBlue_1

public static Color CadetBlue_1 { get; }

Property Value

Color

Chartreuse1

public static Color Chartreuse1 { get; }

Property Value

Color

Chartreuse2

public static Color Chartreuse2 { get; }

Property Value

Color

Chartreuse2_1

public static Color Chartreuse2_1 { get; }

Property Value

Color

Chartreuse3

public static Color Chartreuse3 { get; }

Property Value

Color

Chartreuse3_1

public static Color Chartreuse3_1 { get; }

Property Value

Color

Chartreuse4

public static Color Chartreuse4 { get; }

Property Value

Color

Coral

public static Color Coral { get; }

Property Value

Color

CornflowerBlue

public static Color CornflowerBlue { get; }

Property Value

Color

Cornsilk1

public static Color Cornsilk1 { get; }

Property Value

Color

Cyan

public static Color Cyan { get; }

Property Value

Color

Cyan1

public static Color Cyan1 { get; }

Property Value

Color

Cyan2

public static Color Cyan2 { get; }

Property Value

Color

Cyan3

public static Color Cyan3 { get; }

Property Value

Color

DarkBlue

public static Color DarkBlue { get; }

Property Value

Color

DarkCyan

public static Color DarkCyan { get; }

Property Value

Color

DarkGoldenrod

public static Color DarkGoldenrod { get; }

Property Value

Color

DarkGreen

public static Color DarkGreen { get; }

Property Value

Color

DarkKhaki

public static Color DarkKhaki { get; }

Property Value

Color

DarkMagenta

public static Color DarkMagenta { get; }

Property Value

Color

DarkMagenta_1

public static Color DarkMagenta_1 { get; }

Property Value

Color

DarkOliveGreen1

public static Color DarkOliveGreen1 { get; }

Property Value

Color

DarkOliveGreen1_1

public static Color DarkOliveGreen1_1 { get; }

Property Value

Color

DarkOliveGreen1_2

public static Color DarkOliveGreen1_2 { get; }

Property Value

Color

DarkOliveGreen2

public static Color DarkOliveGreen2 { get; }

Property Value

Color

DarkOliveGreen3

public static Color DarkOliveGreen3 { get; }

Property Value

Color

DarkOliveGreen3_1

public static Color DarkOliveGreen3_1 { get; }

Property Value

Color

DarkOliveGreen3_2

public static Color DarkOliveGreen3_2 { get; }

Property Value

Color

DarkOrange

public static Color DarkOrange { get; }

Property Value

Color

DarkOrange3

public static Color DarkOrange3 { get; }

Property Value

Color

DarkOrange3_1

public static Color DarkOrange3_1 { get; }

Property Value

Color

DarkRed

public static Color DarkRed { get; }

Property Value

Color

DarkRed_1

public static Color DarkRed_1 { get; }

Property Value

Color

DarkSeaGreen

public static Color DarkSeaGreen { get; }

Property Value

Color

DarkSeaGreen1

public static Color DarkSeaGreen1 { get; }

Property Value

Color

DarkSeaGreen1_1

public static Color DarkSeaGreen1_1 { get; }

Property Value

Color

DarkSeaGreen2

public static Color DarkSeaGreen2 { get; }

Property Value

Color

DarkSeaGreen2_1

public static Color DarkSeaGreen2_1 { get; }

Property Value

Color

DarkSeaGreen3

public static Color DarkSeaGreen3 { get; }

Property Value

Color

DarkSeaGreen3_1

public static Color DarkSeaGreen3_1 { get; }

Property Value

Color

DarkSeaGreen4

public static Color DarkSeaGreen4 { get; }

Property Value

Color

DarkSeaGreen4_1

public static Color DarkSeaGreen4_1 { get; }

Property Value

Color

DarkSlateGray1

public static Color DarkSlateGray1 { get; }

Property Value

Color

DarkSlateGray2

public static Color DarkSlateGray2 { get; }

Property Value

Color

DarkSlateGray3

public static Color DarkSlateGray3 { get; }

Property Value

Color

DarkTurquoise

public static Color DarkTurquoise { get; }

Property Value

Color

DarkViolet

public static Color DarkViolet { get; }

Property Value

Color

DarkViolet_1

public static Color DarkViolet_1 { get; }

Property Value

Color

DarkYellow

public static Color DarkYellow { get; }

Property Value

Color

DeepPink1

public static Color DeepPink1 { get; }

Property Value

Color

DeepPink1_1

public static Color DeepPink1_1 { get; }

Property Value

Color

DeepPink2

public static Color DeepPink2 { get; }

Property Value

Color

DeepPink3

public static Color DeepPink3 { get; }

Property Value

Color

DeepPink3_1

public static Color DeepPink3_1 { get; }

Property Value

Color

DeepPink4

public static Color DeepPink4 { get; }

Property Value

Color

DeepPink4_1

public static Color DeepPink4_1 { get; }

Property Value

Color

DeepPink4_2

public static Color DeepPink4_2 { get; }

Property Value

Color

DeepSkyBlue1

public static Color DeepSkyBlue1 { get; }

Property Value

Color

DeepSkyBlue2

public static Color DeepSkyBlue2 { get; }

Property Value

Color

DeepSkyBlue3

public static Color DeepSkyBlue3 { get; }

Property Value

Color

DeepSkyBlue3_1

public static Color DeepSkyBlue3_1 { get; }

Property Value

Color

DeepSkyBlue4

public static Color DeepSkyBlue4 { get; }

Property Value

Color

DeepSkyBlue4_1

public static Color DeepSkyBlue4_1 { get; }

Property Value

Color

DeepSkyBlue4_2

public static Color DeepSkyBlue4_2 { get; }

Property Value

Color

Default

Sentinel: "no explicit color, inherit from context".

public static Color Default { get; }

Property Value

Color

DodgerBlue1

public static Color DodgerBlue1 { get; }

Property Value

Color

DodgerBlue2

public static Color DodgerBlue2 { get; }

Property Value

Color

DodgerBlue3

public static Color DodgerBlue3 { get; }

Property Value

Color

Fuchsia

public static Color Fuchsia { get; }

Property Value

Color

G

RGB green component (0-255).

public byte G { get; }

Property Value

byte

Gold1

public static Color Gold1 { get; }

Property Value

Color

Gold3

public static Color Gold3 { get; }

Property Value

Color

Gold3_1

public static Color Gold3_1 { get; }

Property Value

Color

Gray

public static Color Gray { get; }

Property Value

Color

Green

public static Color Green { get; }

Property Value

Color

Green1

public static Color Green1 { get; }

Property Value

Color

Green3

public static Color Green3 { get; }

Property Value

Color

Green3_1

public static Color Green3_1 { get; }

Property Value

Color

Green4

public static Color Green4 { get; }

Property Value

Color

GreenYellow

public static Color GreenYellow { get; }

Property Value

Color

Grey

public static Color Grey { get; }

Property Value

Color

Grey0

public static Color Grey0 { get; }

Property Value

Color

Grey100

public static Color Grey100 { get; }

Property Value

Color

Grey11

public static Color Grey11 { get; }

Property Value

Color

Grey15

public static Color Grey15 { get; }

Property Value

Color

Grey19

public static Color Grey19 { get; }

Property Value

Color

Grey23

public static Color Grey23 { get; }

Property Value

Color

Grey27

public static Color Grey27 { get; }

Property Value

Color

Grey3

public static Color Grey3 { get; }

Property Value

Color

Grey30

public static Color Grey30 { get; }

Property Value

Color

Grey35

public static Color Grey35 { get; }

Property Value

Color

Grey37

public static Color Grey37 { get; }

Property Value

Color

Grey39

public static Color Grey39 { get; }

Property Value

Color

Grey42

public static Color Grey42 { get; }

Property Value

Color

Grey46

public static Color Grey46 { get; }

Property Value

Color

Grey50

public static Color Grey50 { get; }

Property Value

Color

Grey53

public static Color Grey53 { get; }

Property Value

Color

Grey54

public static Color Grey54 { get; }

Property Value

Color

Grey58

public static Color Grey58 { get; }

Property Value

Color

Grey62

public static Color Grey62 { get; }

Property Value

Color

Grey63

public static Color Grey63 { get; }

Property Value

Color

Grey66

public static Color Grey66 { get; }

Property Value

Color

Grey69

public static Color Grey69 { get; }

Property Value

Color

Grey7

public static Color Grey7 { get; }

Property Value

Color

Grey70

public static Color Grey70 { get; }

Property Value

Color

Grey74

public static Color Grey74 { get; }

Property Value

Color

Grey78

public static Color Grey78 { get; }

Property Value

Color

Grey82

public static Color Grey82 { get; }

Property Value

Color

Grey84

public static Color Grey84 { get; }

Property Value

Color

Grey85

public static Color Grey85 { get; }

Property Value

Color

Grey89

public static Color Grey89 { get; }

Property Value

Color

Grey93

public static Color Grey93 { get; }

Property Value

Color

Honeydew2

public static Color Honeydew2 { get; }

Property Value

Color

HotPink

public static Color HotPink { get; }

Property Value

Color

HotPink2

public static Color HotPink2 { get; }

Property Value

Color

HotPink3

public static Color HotPink3 { get; }

Property Value

Color

HotPink3_1

public static Color HotPink3_1 { get; }

Property Value

Color

HotPink_1

public static Color HotPink_1 { get; }

Property Value

Color

IndianRed

public static Color IndianRed { get; }

Property Value

Color

IndianRed1

public static Color IndianRed1 { get; }

Property Value

Color

IndianRed1_1

public static Color IndianRed1_1 { get; }

Property Value

Color

IndianRed_1

public static Color IndianRed_1 { get; }

Property Value

Color

IsDefault

True when this color was created via default or Default, meaning "inherit from theme/container".

public bool IsDefault { get; }

Property Value

bool

Khaki1

public static Color Khaki1 { get; }

Property Value

Color

Khaki3

public static Color Khaki3 { get; }

Property Value

Color

LightBlue

public static Color LightBlue { get; }

Property Value

Color

LightCoral

public static Color LightCoral { get; }

Property Value

Color

LightCyan1

public static Color LightCyan1 { get; }

Property Value

Color

LightCyan3

public static Color LightCyan3 { get; }

Property Value

Color

LightGoldenrod1

public static Color LightGoldenrod1 { get; }

Property Value

Color

LightGoldenrod2

public static Color LightGoldenrod2 { get; }

Property Value

Color

LightGoldenrod2_1

public static Color LightGoldenrod2_1 { get; }

Property Value

Color

LightGoldenrod2_2

public static Color LightGoldenrod2_2 { get; }

Property Value

Color

LightGoldenrod3

public static Color LightGoldenrod3 { get; }

Property Value

Color

LightGoldenrodYellow

public static Color LightGoldenrodYellow { get; }

Property Value

Color

LightGreen

public static Color LightGreen { get; }

Property Value

Color

LightGreen_1

public static Color LightGreen_1 { get; }

Property Value

Color

LightPink1

public static Color LightPink1 { get; }

Property Value

Color

LightPink3

public static Color LightPink3 { get; }

Property Value

Color

LightPink4

public static Color LightPink4 { get; }

Property Value

Color

LightSalmon1

public static Color LightSalmon1 { get; }

Property Value

Color

LightSalmon3

public static Color LightSalmon3 { get; }

Property Value

Color

LightSalmon3_1

public static Color LightSalmon3_1 { get; }

Property Value

Color

LightSeaGreen

public static Color LightSeaGreen { get; }

Property Value

Color

LightSkyBlue1

public static Color LightSkyBlue1 { get; }

Property Value

Color

LightSkyBlue3

public static Color LightSkyBlue3 { get; }

Property Value

Color

LightSkyBlue3_1

public static Color LightSkyBlue3_1 { get; }

Property Value

Color

LightSlateBlue

public static Color LightSlateBlue { get; }

Property Value

Color

LightSlateGrey

public static Color LightSlateGrey { get; }

Property Value

Color

LightSteelBlue

public static Color LightSteelBlue { get; }

Property Value

Color

LightSteelBlue1

public static Color LightSteelBlue1 { get; }

Property Value

Color

LightSteelBlue3

public static Color LightSteelBlue3 { get; }

Property Value

Color

LightYellow1

public static Color LightYellow1 { get; }

Property Value

Color

LightYellow3

public static Color LightYellow3 { get; }

Property Value

Color

Lime

public static Color Lime { get; }

Property Value

Color

Magenta

public static Color Magenta { get; }

Property Value

Color

Magenta1

public static Color Magenta1 { get; }

Property Value

Color

Magenta2

public static Color Magenta2 { get; }

Property Value

Color

Magenta2_1

public static Color Magenta2_1 { get; }

Property Value

Color

Magenta3

public static Color Magenta3 { get; }

Property Value

Color

Magenta3_1

public static Color Magenta3_1 { get; }

Property Value

Color

Magenta3_2

public static Color Magenta3_2 { get; }

Property Value

Color

Maroon

public static Color Maroon { get; }

Property Value

Color

MediumOrchid

public static Color MediumOrchid { get; }

Property Value

Color

MediumOrchid1

public static Color MediumOrchid1 { get; }

Property Value

Color

MediumOrchid1_1

public static Color MediumOrchid1_1 { get; }

Property Value

Color

MediumOrchid3

public static Color MediumOrchid3 { get; }

Property Value

Color

MediumPurple

public static Color MediumPurple { get; }

Property Value

Color

MediumPurple1

public static Color MediumPurple1 { get; }

Property Value

Color

MediumPurple2

public static Color MediumPurple2 { get; }

Property Value

Color

MediumPurple2_1

public static Color MediumPurple2_1 { get; }

Property Value

Color

MediumPurple3

public static Color MediumPurple3 { get; }

Property Value

Color

MediumPurple3_1

public static Color MediumPurple3_1 { get; }

Property Value

Color

MediumPurple4

public static Color MediumPurple4 { get; }

Property Value

Color

MediumSeaGreen

public static Color MediumSeaGreen { get; }

Property Value

Color

MediumSlateBlue

public static Color MediumSlateBlue { get; }

Property Value

Color

MediumSpringGreen

public static Color MediumSpringGreen { get; }

Property Value

Color

MediumTurquoise

public static Color MediumTurquoise { get; }

Property Value

Color

MediumVioletRed

public static Color MediumVioletRed { get; }

Property Value

Color

MistyRose1

public static Color MistyRose1 { get; }

Property Value

Color

MistyRose3

public static Color MistyRose3 { get; }

Property Value

Color

NavajoWhite1

public static Color NavajoWhite1 { get; }

Property Value

Color

NavajoWhite3

public static Color NavajoWhite3 { get; }

Property Value

Color

Navy

public static Color Navy { get; }

Property Value

Color

NavyBlue

public static Color NavyBlue { get; }

Property Value

Color

Olive

public static Color Olive { get; }

Property Value

Color

Orange1

public static Color Orange1 { get; }

Property Value

Color

Orange3

public static Color Orange3 { get; }

Property Value

Color

Orange4

public static Color Orange4 { get; }

Property Value

Color

Orange4_1

public static Color Orange4_1 { get; }

Property Value

Color

OrangeRed1

public static Color OrangeRed1 { get; }

Property Value

Color

Orchid

public static Color Orchid { get; }

Property Value

Color

Orchid1

public static Color Orchid1 { get; }

Property Value

Color

Orchid2

public static Color Orchid2 { get; }

Property Value

Color

PaleGreen1

public static Color PaleGreen1 { get; }

Property Value

Color

PaleGreen1_1

public static Color PaleGreen1_1 { get; }

Property Value

Color

PaleGreen3

public static Color PaleGreen3 { get; }

Property Value

Color

PaleGreen3_1

public static Color PaleGreen3_1 { get; }

Property Value

Color

PaleTurquoise1

public static Color PaleTurquoise1 { get; }

Property Value

Color

PaleTurquoise4

public static Color PaleTurquoise4 { get; }

Property Value

Color

PaleVioletRed

public static Color PaleVioletRed { get; }

Property Value

Color

PaleVioletRed1

public static Color PaleVioletRed1 { get; }

Property Value

Color

Pink1

public static Color Pink1 { get; }

Property Value

Color

Pink3

public static Color Pink3 { get; }

Property Value

Color

Plum1

public static Color Plum1 { get; }

Property Value

Color

Plum2

public static Color Plum2 { get; }

Property Value

Color

Plum3

public static Color Plum3 { get; }

Property Value

Color

Plum4

public static Color Plum4 { get; }

Property Value

Color

Purple

public static Color Purple { get; }

Property Value

Color

Purple3

public static Color Purple3 { get; }

Property Value

Color

Purple4

public static Color Purple4 { get; }

Property Value

Color

Purple4_1

public static Color Purple4_1 { get; }

Property Value

Color

Purple_1

public static Color Purple_1 { get; }

Property Value

Color

Purple_2

public static Color Purple_2 { get; }

Property Value

Color

R

RGB red component (0-255).

public byte R { get; }

Property Value

byte

Red

public static Color Red { get; }

Property Value

Color

Red1

public static Color Red1 { get; }

Property Value

Color

Red3

public static Color Red3 { get; }

Property Value

Color

Red3_1

public static Color Red3_1 { get; }

Property Value

Color

RosyBrown

public static Color RosyBrown { get; }

Property Value

Color

RoyalBlue1

public static Color RoyalBlue1 { get; }

Property Value

Color

Salmon1

public static Color Salmon1 { get; }

Property Value

Color

SandyBrown

public static Color SandyBrown { get; }

Property Value

Color

SeaGreen1

public static Color SeaGreen1 { get; }

Property Value

Color

SeaGreen1_1

public static Color SeaGreen1_1 { get; }

Property Value

Color

SeaGreen2

public static Color SeaGreen2 { get; }

Property Value

Color

SeaGreen3

public static Color SeaGreen3 { get; }

Property Value

Color

Silver

public static Color Silver { get; }

Property Value

Color

SkyBlue1

public static Color SkyBlue1 { get; }

Property Value

Color

SkyBlue2

public static Color SkyBlue2 { get; }

Property Value

Color

SkyBlue3

public static Color SkyBlue3 { get; }

Property Value

Color

SlateBlue1

public static Color SlateBlue1 { get; }

Property Value

Color

SlateBlue3

public static Color SlateBlue3 { get; }

Property Value

Color

SlateBlue3_1

public static Color SlateBlue3_1 { get; }

Property Value

Color

SpringGreen1

public static Color SpringGreen1 { get; }

Property Value

Color

SpringGreen2

public static Color SpringGreen2 { get; }

Property Value

Color

SpringGreen2_1

public static Color SpringGreen2_1 { get; }

Property Value

Color

SpringGreen3

public static Color SpringGreen3 { get; }

Property Value

Color

SpringGreen3_1

public static Color SpringGreen3_1 { get; }

Property Value

Color

SpringGreen4

public static Color SpringGreen4 { get; }

Property Value

Color

SteelBlue

public static Color SteelBlue { get; }

Property Value

Color

SteelBlue1

public static Color SteelBlue1 { get; }

Property Value

Color

SteelBlue1_1

public static Color SteelBlue1_1 { get; }

Property Value

Color

SteelBlue3

public static Color SteelBlue3 { get; }

Property Value

Color

Tan

public static Color Tan { get; }

Property Value

Color

Teal

public static Color Teal { get; }

Property Value

Color

Thistle1

public static Color Thistle1 { get; }

Property Value

Color

Thistle3

public static Color Thistle3 { get; }

Property Value

Color

Transparent

Fully transparent — composites over whatever is already in the buffer.

public static Color Transparent { get; }

Property Value

Color

Turquoise2

public static Color Turquoise2 { get; }

Property Value

Color

Turquoise4

public static Color Turquoise4 { get; }

Property Value

Color

Violet

public static Color Violet { get; }

Property Value

Color

Wheat1

public static Color Wheat1 { get; }

Property Value

Color

Wheat4

public static Color Wheat4 { get; }

Property Value

Color

White

public static Color White { get; }

Property Value

Color

Yellow

public static Color Yellow { get; }

Property Value

Color

Yellow1

public static Color Yellow1 { get; }

Property Value

Color

Yellow2

public static Color Yellow2 { get; }

Property Value

Color

Yellow3

public static Color Yellow3 { get; }

Property Value

Color

Yellow3_1

public static Color Yellow3_1 { get; }

Property Value

Color

Yellow4

public static Color Yellow4 { get; }

Property Value

Color

Yellow4_1

public static Color Yellow4_1 { get; }

Property Value

Color

Methods

Blend(Color, Color)

Composites src over dst using Porter-Duff "over". Fast paths: fully opaque src (A=255) returns src; fully transparent src (A=0) returns dst. If dst.IsDefault, returns src unmodified (no RGB to blend against). Always returns a fully opaque color (A=255) — alpha is consumed at blend time.

public static Color Blend(Color src, Color dst)

Parameters

src Color
dst Color

Returns

Color

Equals(Color)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Color other)

Parameters

other Color

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

FromInt32(int)

Creates a Color from a 256-color palette index (0-255). Indices 0-7 are standard colors, 8-15 are bright colors, 16-231 are a 6x6x6 RGB cube, 232-255 are grayscale.

public static Color FromInt32(int index)

Parameters

index int

Returns

Color

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToMarkup()

Returns the color as a markup string. For opaque colors, returns a Spectre-compatible "rgb(R,G,B)" string. For semi-transparent colors, returns "rgba(R,G,B,A)" which is interpreted by the framework's own renderer, not by Spectre.Console.

public string ToMarkup()

Returns

string

ToString()

Returns the color as "Color(R, G, B)" or "Color(Default)".

public override string ToString()

Returns

string

TryFromHex(string, out Color)

Attempts to parse a hex color string (#RGB, #RRGGBB, or RRGGBB).

public static bool TryFromHex(string hex, out Color color)

Parameters

hex string
color Color

Returns

bool

TryFromName(string, out Color)

Attempts to resolve a color name to a Color value.

public static bool TryFromName(string name, out Color color)

Parameters

name string
color Color

Returns

bool

WithAlpha(byte)

Returns a copy of this color with the specified alpha value.

public Color WithAlpha(byte a)

Parameters

a byte

Returns

Color

Operators

operator ==(Color, Color)

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

Parameters

left Color
right Color

Returns

bool

implicit operator Color(Color)

Implicit conversion to Spectre.Console.Color for migration compatibility.

public static implicit operator Color(Color color)

Parameters

color Color

Returns

Color

implicit operator Color(Color)

Implicit conversion from Spectre.Console.Color for migration compatibility.

public static implicit operator Color(Color spectreColor)

Parameters

spectreColor Color

Returns

Color

operator !=(Color, Color)

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

Parameters

left Color
right Color

Returns

bool