Skip to content

webmaster442.windowsterminal.color

webmaster442 edited this page Jun 9, 2025 · 2 revisions

< Back


Color

Namespace: Webmaster442.WindowsTerminal

Represents a color in RGB format.

public struct Color

Inheritance Object → ValueType → Color
Implements IParsable<Color>, IEquatable<Color>
Attributes IsReadOnlyAttribute

Properties

R

Gets the Red component.

public byte R { get; }

Property Value

Byte

G

Gets the Green component.

public byte G { get; }

Property Value

Byte

B

Gets the Blue component.

public byte B { get; }

Property Value

Byte

Constructors

Color(Byte, Byte, Byte)

Initializes a new instance of the Color struct with the specified RGB values.

Color(byte r, byte g, byte b)

Parameters

r Byte
The red component.

g Byte
The green component.

b Byte
The blue component.

Methods

Parse(String, IFormatProvider)

Parse a color from a string representation.

Color Parse(string s, IFormatProvider provider)

Parameters

s String
string representation. Supported formats are: Supported are: rgb(r, g, b), ##rrggbb and hsl(h, s%, l%)

provider IFormatProvider
format provider

Returns

Color
A color in RGB space

Exceptions

FormatException
Invalid format was specified

TryParse(String, IFormatProvider, Color&)

Try to Parse a color from a string representation.

bool TryParse(string s, IFormatProvider provider, Color& result)

Parameters

s String
string representation. Supported formats are: Supported are: rgb(r, g, b), ##rrggbb and hsl(h, s%, l%)

provider IFormatProvider
format provider

result Color&
A color in RGB space

Returns

Boolean
true, if parsing was successfull, otherwise false

FromHsl(Double, Double, Double)

Create a color from its HSL representation.

Color FromHsl(double hue, double saturation, double light)

Parameters

hue Double
Color Hue

saturation Double
Color saturation

light Double
Color light

Returns

Color
A color in RGB space

ToString()

string ToString()

Returns

String

GetHashCode()

int GetHashCode()

Returns

Int32

Equals(Object)

bool Equals(object obj)

Parameters

obj Object

Returns

Boolean

Equals(Color)

bool Equals(Color other)

Parameters

other Color

Returns

Boolean


< Back

Documentation

Clone this wiki locally