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
Properties
A
Alpha component (0 = fully transparent, 255 = fully opaque).
public byte A { get; }
Property Value
Aqua
public static Color Aqua { get; }
Property Value
Aquamarine1
public static Color Aquamarine1 { get; }
Property Value
Aquamarine1_1
public static Color Aquamarine1_1 { get; }
Property Value
Aquamarine3
public static Color Aquamarine3 { get; }
Property Value
B
RGB blue component (0-255).
public byte B { get; }
Property Value
Black
public static Color Black { get; }
Property Value
Blue
public static Color Blue { get; }
Property Value
Blue1
public static Color Blue1 { get; }
Property Value
Blue3
public static Color Blue3 { get; }
Property Value
Blue3_1
public static Color Blue3_1 { get; }
Property Value
BlueViolet
public static Color BlueViolet { get; }
Property Value
CadetBlue
public static Color CadetBlue { get; }
Property Value
CadetBlue_1
public static Color CadetBlue_1 { get; }
Property Value
Chartreuse1
public static Color Chartreuse1 { get; }
Property Value
Chartreuse2
public static Color Chartreuse2 { get; }
Property Value
Chartreuse2_1
public static Color Chartreuse2_1 { get; }
Property Value
Chartreuse3
public static Color Chartreuse3 { get; }
Property Value
Chartreuse3_1
public static Color Chartreuse3_1 { get; }
Property Value
Chartreuse4
public static Color Chartreuse4 { get; }
Property Value
Coral
public static Color Coral { get; }
Property Value
CornflowerBlue
public static Color CornflowerBlue { get; }
Property Value
Cornsilk1
public static Color Cornsilk1 { get; }
Property Value
Cyan
public static Color Cyan { get; }
Property Value
Cyan1
public static Color Cyan1 { get; }
Property Value
Cyan2
public static Color Cyan2 { get; }
Property Value
Cyan3
public static Color Cyan3 { get; }
Property Value
DarkBlue
public static Color DarkBlue { get; }
Property Value
DarkCyan
public static Color DarkCyan { get; }
Property Value
DarkGoldenrod
public static Color DarkGoldenrod { get; }
Property Value
DarkGreen
public static Color DarkGreen { get; }
Property Value
DarkKhaki
public static Color DarkKhaki { get; }
Property Value
DarkMagenta
public static Color DarkMagenta { get; }
Property Value
DarkMagenta_1
public static Color DarkMagenta_1 { get; }
Property Value
DarkOliveGreen1
public static Color DarkOliveGreen1 { get; }
Property Value
DarkOliveGreen1_1
public static Color DarkOliveGreen1_1 { get; }
Property Value
DarkOliveGreen1_2
public static Color DarkOliveGreen1_2 { get; }
Property Value
DarkOliveGreen2
public static Color DarkOliveGreen2 { get; }
Property Value
DarkOliveGreen3
public static Color DarkOliveGreen3 { get; }
Property Value
DarkOliveGreen3_1
public static Color DarkOliveGreen3_1 { get; }
Property Value
DarkOliveGreen3_2
public static Color DarkOliveGreen3_2 { get; }
Property Value
DarkOrange
public static Color DarkOrange { get; }
Property Value
DarkOrange3
public static Color DarkOrange3 { get; }
Property Value
DarkOrange3_1
public static Color DarkOrange3_1 { get; }
Property Value
DarkRed
public static Color DarkRed { get; }
Property Value
DarkRed_1
public static Color DarkRed_1 { get; }
Property Value
DarkSeaGreen
public static Color DarkSeaGreen { get; }
Property Value
DarkSeaGreen1
public static Color DarkSeaGreen1 { get; }
Property Value
DarkSeaGreen1_1
public static Color DarkSeaGreen1_1 { get; }
Property Value
DarkSeaGreen2
public static Color DarkSeaGreen2 { get; }
Property Value
DarkSeaGreen2_1
public static Color DarkSeaGreen2_1 { get; }
Property Value
DarkSeaGreen3
public static Color DarkSeaGreen3 { get; }
Property Value
DarkSeaGreen3_1
public static Color DarkSeaGreen3_1 { get; }
Property Value
DarkSeaGreen4
public static Color DarkSeaGreen4 { get; }
Property Value
DarkSeaGreen4_1
public static Color DarkSeaGreen4_1 { get; }
Property Value
DarkSlateGray1
public static Color DarkSlateGray1 { get; }
Property Value
DarkSlateGray2
public static Color DarkSlateGray2 { get; }
Property Value
DarkSlateGray3
public static Color DarkSlateGray3 { get; }
Property Value
DarkTurquoise
public static Color DarkTurquoise { get; }
Property Value
DarkViolet
public static Color DarkViolet { get; }
Property Value
DarkViolet_1
public static Color DarkViolet_1 { get; }
Property Value
DarkYellow
public static Color DarkYellow { get; }
Property Value
DeepPink1
public static Color DeepPink1 { get; }
Property Value
DeepPink1_1
public static Color DeepPink1_1 { get; }
Property Value
DeepPink2
public static Color DeepPink2 { get; }
Property Value
DeepPink3
public static Color DeepPink3 { get; }
Property Value
DeepPink3_1
public static Color DeepPink3_1 { get; }
Property Value
DeepPink4
public static Color DeepPink4 { get; }
Property Value
DeepPink4_1
public static Color DeepPink4_1 { get; }
Property Value
DeepPink4_2
public static Color DeepPink4_2 { get; }
Property Value
DeepSkyBlue1
public static Color DeepSkyBlue1 { get; }
Property Value
DeepSkyBlue2
public static Color DeepSkyBlue2 { get; }
Property Value
DeepSkyBlue3
public static Color DeepSkyBlue3 { get; }
Property Value
DeepSkyBlue3_1
public static Color DeepSkyBlue3_1 { get; }
Property Value
DeepSkyBlue4
public static Color DeepSkyBlue4 { get; }
Property Value
DeepSkyBlue4_1
public static Color DeepSkyBlue4_1 { get; }
Property Value
DeepSkyBlue4_2
public static Color DeepSkyBlue4_2 { get; }
Property Value
Default
Sentinel: "no explicit color, inherit from context".
public static Color Default { get; }
Property Value
DodgerBlue1
public static Color DodgerBlue1 { get; }
Property Value
DodgerBlue2
public static Color DodgerBlue2 { get; }
Property Value
DodgerBlue3
public static Color DodgerBlue3 { get; }
Property Value
Fuchsia
public static Color Fuchsia { get; }
Property Value
G
RGB green component (0-255).
public byte G { get; }
Property Value
Gold1
public static Color Gold1 { get; }
Property Value
Gold3
public static Color Gold3 { get; }
Property Value
Gold3_1
public static Color Gold3_1 { get; }
Property Value
Gray
public static Color Gray { get; }
Property Value
Green
public static Color Green { get; }
Property Value
Green1
public static Color Green1 { get; }
Property Value
Green3
public static Color Green3 { get; }
Property Value
Green3_1
public static Color Green3_1 { get; }
Property Value
Green4
public static Color Green4 { get; }
Property Value
GreenYellow
public static Color GreenYellow { get; }
Property Value
Grey
public static Color Grey { get; }
Property Value
Grey0
public static Color Grey0 { get; }
Property Value
Grey100
public static Color Grey100 { get; }
Property Value
Grey11
public static Color Grey11 { get; }
Property Value
Grey15
public static Color Grey15 { get; }
Property Value
Grey19
public static Color Grey19 { get; }
Property Value
Grey23
public static Color Grey23 { get; }
Property Value
Grey27
public static Color Grey27 { get; }
Property Value
Grey3
public static Color Grey3 { get; }
Property Value
Grey30
public static Color Grey30 { get; }
Property Value
Grey35
public static Color Grey35 { get; }
Property Value
Grey37
public static Color Grey37 { get; }
Property Value
Grey39
public static Color Grey39 { get; }
Property Value
Grey42
public static Color Grey42 { get; }
Property Value
Grey46
public static Color Grey46 { get; }
Property Value
Grey50
public static Color Grey50 { get; }
Property Value
Grey53
public static Color Grey53 { get; }
Property Value
Grey54
public static Color Grey54 { get; }
Property Value
Grey58
public static Color Grey58 { get; }
Property Value
Grey62
public static Color Grey62 { get; }
Property Value
Grey63
public static Color Grey63 { get; }
Property Value
Grey66
public static Color Grey66 { get; }
Property Value
Grey69
public static Color Grey69 { get; }
Property Value
Grey7
public static Color Grey7 { get; }
Property Value
Grey70
public static Color Grey70 { get; }
Property Value
Grey74
public static Color Grey74 { get; }
Property Value
Grey78
public static Color Grey78 { get; }
Property Value
Grey82
public static Color Grey82 { get; }
Property Value
Grey84
public static Color Grey84 { get; }
Property Value
Grey85
public static Color Grey85 { get; }
Property Value
Grey89
public static Color Grey89 { get; }
Property Value
Grey93
public static Color Grey93 { get; }
Property Value
Honeydew2
public static Color Honeydew2 { get; }
Property Value
HotPink
public static Color HotPink { get; }
Property Value
HotPink2
public static Color HotPink2 { get; }
Property Value
HotPink3
public static Color HotPink3 { get; }
Property Value
HotPink3_1
public static Color HotPink3_1 { get; }
Property Value
HotPink_1
public static Color HotPink_1 { get; }
Property Value
IndianRed
public static Color IndianRed { get; }
Property Value
IndianRed1
public static Color IndianRed1 { get; }
Property Value
IndianRed1_1
public static Color IndianRed1_1 { get; }
Property Value
IndianRed_1
public static Color IndianRed_1 { get; }
Property Value
IsDefault
True when this color was created via default or Default,
meaning "inherit from theme/container".
public bool IsDefault { get; }
Property Value
Khaki1
public static Color Khaki1 { get; }
Property Value
Khaki3
public static Color Khaki3 { get; }
Property Value
LightBlue
public static Color LightBlue { get; }
Property Value
LightCoral
public static Color LightCoral { get; }
Property Value
LightCyan1
public static Color LightCyan1 { get; }
Property Value
LightCyan3
public static Color LightCyan3 { get; }
Property Value
LightGoldenrod1
public static Color LightGoldenrod1 { get; }
Property Value
LightGoldenrod2
public static Color LightGoldenrod2 { get; }
Property Value
LightGoldenrod2_1
public static Color LightGoldenrod2_1 { get; }
Property Value
LightGoldenrod2_2
public static Color LightGoldenrod2_2 { get; }
Property Value
LightGoldenrod3
public static Color LightGoldenrod3 { get; }
Property Value
LightGoldenrodYellow
public static Color LightGoldenrodYellow { get; }
Property Value
LightGreen
public static Color LightGreen { get; }
Property Value
LightGreen_1
public static Color LightGreen_1 { get; }
Property Value
LightPink1
public static Color LightPink1 { get; }
Property Value
LightPink3
public static Color LightPink3 { get; }
Property Value
LightPink4
public static Color LightPink4 { get; }
Property Value
LightSalmon1
public static Color LightSalmon1 { get; }
Property Value
LightSalmon3
public static Color LightSalmon3 { get; }
Property Value
LightSalmon3_1
public static Color LightSalmon3_1 { get; }
Property Value
LightSeaGreen
public static Color LightSeaGreen { get; }
Property Value
LightSkyBlue1
public static Color LightSkyBlue1 { get; }
Property Value
LightSkyBlue3
public static Color LightSkyBlue3 { get; }
Property Value
LightSkyBlue3_1
public static Color LightSkyBlue3_1 { get; }
Property Value
LightSlateBlue
public static Color LightSlateBlue { get; }
Property Value
LightSlateGrey
public static Color LightSlateGrey { get; }
Property Value
LightSteelBlue
public static Color LightSteelBlue { get; }
Property Value
LightSteelBlue1
public static Color LightSteelBlue1 { get; }
Property Value
LightSteelBlue3
public static Color LightSteelBlue3 { get; }
Property Value
LightYellow1
public static Color LightYellow1 { get; }
Property Value
LightYellow3
public static Color LightYellow3 { get; }
Property Value
Lime
public static Color Lime { get; }
Property Value
Magenta
public static Color Magenta { get; }
Property Value
Magenta1
public static Color Magenta1 { get; }
Property Value
Magenta2
public static Color Magenta2 { get; }
Property Value
Magenta2_1
public static Color Magenta2_1 { get; }
Property Value
Magenta3
public static Color Magenta3 { get; }
Property Value
Magenta3_1
public static Color Magenta3_1 { get; }
Property Value
Magenta3_2
public static Color Magenta3_2 { get; }
Property Value
Maroon
public static Color Maroon { get; }
Property Value
MediumOrchid
public static Color MediumOrchid { get; }
Property Value
MediumOrchid1
public static Color MediumOrchid1 { get; }
Property Value
MediumOrchid1_1
public static Color MediumOrchid1_1 { get; }
Property Value
MediumOrchid3
public static Color MediumOrchid3 { get; }
Property Value
MediumPurple
public static Color MediumPurple { get; }
Property Value
MediumPurple1
public static Color MediumPurple1 { get; }
Property Value
MediumPurple2
public static Color MediumPurple2 { get; }
Property Value
MediumPurple2_1
public static Color MediumPurple2_1 { get; }
Property Value
MediumPurple3
public static Color MediumPurple3 { get; }
Property Value
MediumPurple3_1
public static Color MediumPurple3_1 { get; }
Property Value
MediumPurple4
public static Color MediumPurple4 { get; }
Property Value
MediumSeaGreen
public static Color MediumSeaGreen { get; }
Property Value
MediumSlateBlue
public static Color MediumSlateBlue { get; }
Property Value
MediumSpringGreen
public static Color MediumSpringGreen { get; }
Property Value
MediumTurquoise
public static Color MediumTurquoise { get; }
Property Value
MediumVioletRed
public static Color MediumVioletRed { get; }
Property Value
MistyRose1
public static Color MistyRose1 { get; }
Property Value
MistyRose3
public static Color MistyRose3 { get; }
Property Value
NavajoWhite1
public static Color NavajoWhite1 { get; }
Property Value
NavajoWhite3
public static Color NavajoWhite3 { get; }
Property Value
Navy
public static Color Navy { get; }
Property Value
NavyBlue
public static Color NavyBlue { get; }
Property Value
Olive
public static Color Olive { get; }
Property Value
Orange1
public static Color Orange1 { get; }
Property Value
Orange3
public static Color Orange3 { get; }
Property Value
Orange4
public static Color Orange4 { get; }
Property Value
Orange4_1
public static Color Orange4_1 { get; }
Property Value
OrangeRed1
public static Color OrangeRed1 { get; }
Property Value
Orchid
public static Color Orchid { get; }
Property Value
Orchid1
public static Color Orchid1 { get; }
Property Value
Orchid2
public static Color Orchid2 { get; }
Property Value
PaleGreen1
public static Color PaleGreen1 { get; }
Property Value
PaleGreen1_1
public static Color PaleGreen1_1 { get; }
Property Value
PaleGreen3
public static Color PaleGreen3 { get; }
Property Value
PaleGreen3_1
public static Color PaleGreen3_1 { get; }
Property Value
PaleTurquoise1
public static Color PaleTurquoise1 { get; }
Property Value
PaleTurquoise4
public static Color PaleTurquoise4 { get; }
Property Value
PaleVioletRed
public static Color PaleVioletRed { get; }
Property Value
PaleVioletRed1
public static Color PaleVioletRed1 { get; }
Property Value
Pink1
public static Color Pink1 { get; }
Property Value
Pink3
public static Color Pink3 { get; }
Property Value
Plum1
public static Color Plum1 { get; }
Property Value
Plum2
public static Color Plum2 { get; }
Property Value
Plum3
public static Color Plum3 { get; }
Property Value
Plum4
public static Color Plum4 { get; }
Property Value
Purple
public static Color Purple { get; }
Property Value
Purple3
public static Color Purple3 { get; }
Property Value
Purple4
public static Color Purple4 { get; }
Property Value
Purple4_1
public static Color Purple4_1 { get; }
Property Value
Purple_1
public static Color Purple_1 { get; }
Property Value
Purple_2
public static Color Purple_2 { get; }
Property Value
R
RGB red component (0-255).
public byte R { get; }
Property Value
Red
public static Color Red { get; }
Property Value
Red1
public static Color Red1 { get; }
Property Value
Red3
public static Color Red3 { get; }
Property Value
Red3_1
public static Color Red3_1 { get; }
Property Value
RosyBrown
public static Color RosyBrown { get; }
Property Value
RoyalBlue1
public static Color RoyalBlue1 { get; }
Property Value
Salmon1
public static Color Salmon1 { get; }
Property Value
SandyBrown
public static Color SandyBrown { get; }
Property Value
SeaGreen1
public static Color SeaGreen1 { get; }
Property Value
SeaGreen1_1
public static Color SeaGreen1_1 { get; }
Property Value
SeaGreen2
public static Color SeaGreen2 { get; }
Property Value
SeaGreen3
public static Color SeaGreen3 { get; }
Property Value
Silver
public static Color Silver { get; }
Property Value
SkyBlue1
public static Color SkyBlue1 { get; }
Property Value
SkyBlue2
public static Color SkyBlue2 { get; }
Property Value
SkyBlue3
public static Color SkyBlue3 { get; }
Property Value
SlateBlue1
public static Color SlateBlue1 { get; }
Property Value
SlateBlue3
public static Color SlateBlue3 { get; }
Property Value
SlateBlue3_1
public static Color SlateBlue3_1 { get; }
Property Value
SpringGreen1
public static Color SpringGreen1 { get; }
Property Value
SpringGreen2
public static Color SpringGreen2 { get; }
Property Value
SpringGreen2_1
public static Color SpringGreen2_1 { get; }
Property Value
SpringGreen3
public static Color SpringGreen3 { get; }
Property Value
SpringGreen3_1
public static Color SpringGreen3_1 { get; }
Property Value
SpringGreen4
public static Color SpringGreen4 { get; }
Property Value
SteelBlue
public static Color SteelBlue { get; }
Property Value
SteelBlue1
public static Color SteelBlue1 { get; }
Property Value
SteelBlue1_1
public static Color SteelBlue1_1 { get; }
Property Value
SteelBlue3
public static Color SteelBlue3 { get; }
Property Value
Tan
public static Color Tan { get; }
Property Value
Teal
public static Color Teal { get; }
Property Value
Thistle1
public static Color Thistle1 { get; }
Property Value
Thistle3
public static Color Thistle3 { get; }
Property Value
Transparent
Fully transparent — composites over whatever is already in the buffer.
public static Color Transparent { get; }
Property Value
Turquoise2
public static Color Turquoise2 { get; }
Property Value
Turquoise4
public static Color Turquoise4 { get; }
Property Value
Violet
public static Color Violet { get; }
Property Value
Wheat1
public static Color Wheat1 { get; }
Property Value
Wheat4
public static Color Wheat4 { get; }
Property Value
White
public static Color White { get; }
Property Value
Yellow
public static Color Yellow { get; }
Property Value
Yellow1
public static Color Yellow1 { get; }
Property Value
Yellow2
public static Color Yellow2 { get; }
Property Value
Yellow3
public static Color Yellow3 { get; }
Property Value
Yellow3_1
public static Color Yellow3_1 { get; }
Property Value
Yellow4
public static Color Yellow4 { get; }
Property Value
Yellow4_1
public static Color Yellow4_1 { get; }
Property Value
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
Returns
Equals(Color)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Color other)
Parameters
otherColorAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
indexint
Returns
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
ToString()
Returns the color as "Color(R, G, B)" or "Color(Default)".
public override string ToString()
Returns
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
Returns
TryFromName(string, out Color)
Attempts to resolve a color name to a Color value.
public static bool TryFromName(string name, out Color color)
Parameters
Returns
WithAlpha(byte)
Returns a copy of this color with the specified alpha value.
public Color WithAlpha(byte a)
Parameters
abyte
Returns
Operators
operator ==(Color, Color)
public static bool operator ==(Color left, Color right)
Parameters
Returns
implicit operator Color(Color)
Implicit conversion to Spectre.Console.Color for migration compatibility.
public static implicit operator Color(Color color)
Parameters
colorColor
Returns
- Color
implicit operator Color(Color)
Implicit conversion from Spectre.Console.Color for migration compatibility.
public static implicit operator Color(Color spectreColor)
Parameters
spectreColorColor
Returns
operator !=(Color, Color)
public static bool operator !=(Color left, Color right)