Struct Color
Represents a color used in Discord.
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public struct Color
Constructors
| Improve this Doc View SourceColor(Byte, Byte, Byte)
Initializes a Color struct with the given RGB bytes.
Declaration
public Color(byte r, byte g, byte b)
Parameters
Type | Name | Description |
---|---|---|
Byte | r | The byte that represents the red color. |
Byte | g | The byte that represents the green color. |
Byte | b | The byte that represents the blue color. |
Examples
The following will create a color that has a value of #607D8B.
Color darkGrey = new Color((byte)0b_01100000, (byte)0b_01111101, (byte)0b_10001011);
|
Improve this Doc
View Source
Color(Int32, Int32, Int32)
Initializes a Color struct with the given RGB value.
Declaration
public Color(int r, int g, int b)
Parameters
Type | Name | Description |
---|---|---|
Int32 | r | The value that represents the red color. Must be within 0~255. |
Int32 | g | The value that represents the green color. Must be within 0~255. |
Int32 | b | The value that represents the blue color. Must be within 0~255. |
Examples
The following will create a color that has a value of #607D8B.
Color darkGrey = new Color(96, 125, 139);
|
Improve this Doc
View Source
Color(Single, Single, Single)
Initializes a Color struct with the given RGB float value.
Declaration
public Color(float r, float g, float b)
Parameters
Type | Name | Description |
---|---|---|
Single | r | The value that represents the red color. Must be within 0~1. |
Single | g | The value that represents the green color. Must be within 0~1. |
Single | b | The value that represents the blue color. Must be within 0~1. |
Examples
The following will create a color that has a value of #607c8c.
Color darkGrey = new Color(0.38f, 0.49f, 0.55f);
|
Improve this Doc
View Source
Color(UInt32)
Initializes a Color struct with the given raw value.
Declaration
public Color(uint rawValue)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | rawValue | The raw value of the color (e.g. |
Examples
The following will create a color that has a hex value of #607D8B.
Color darkGrey = new Color(0x607D8B);
Fields
| Improve this Doc View SourceBlue
Gets the blue color value.
Declaration
public static readonly Color Blue
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 3498DB. |
DarkBlue
Gets the dark blue color value.
Declaration
public static readonly Color DarkBlue
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 206694. |
DarkerGrey
Gets the darker grey color value.
Declaration
public static readonly Color DarkerGrey
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 546E7A. |
DarkGreen
Gets the dark green color value.
Declaration
public static readonly Color DarkGreen
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 1F8B4C. |
DarkGrey
Gets the dark grey color value.
Declaration
public static readonly Color DarkGrey
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 607D8B. |
DarkMagenta
Gets the dark magenta color value.
Declaration
public static readonly Color DarkMagenta
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of AD1457. |
DarkOrange
Gets the dark orange color value.
Declaration
public static readonly Color DarkOrange
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of A84300. |
DarkPurple
Gets the dark purple color value.
Declaration
public static readonly Color DarkPurple
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 71368A. |
DarkRed
Gets the dark red color value.
Declaration
public static readonly Color DarkRed
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 992D22. |
DarkTeal
Gets the dark teal color value.
Declaration
public static readonly Color DarkTeal
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 11806A. |
Default
Gets the default user color value.
Declaration
public static readonly Color Default
Field Value
Type | Description |
---|---|
Color |
Gold
Gets the gold color value.
Declaration
public static readonly Color Gold
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of F1C40F. |
Green
Gets the green color value.
Declaration
public static readonly Color Green
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 2ECC71. |
LighterGrey
Gets the lighter grey color value.
Declaration
public static readonly Color LighterGrey
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 95A5A6. |
LightGrey
Gets the light grey color value.
Declaration
public static readonly Color LightGrey
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 979C9F. |
LightOrange
Gets the light orange color value.
Declaration
public static readonly Color LightOrange
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of C27C0E. |
Magenta
Gets the magenta color value.
Declaration
public static readonly Color Magenta
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of E91E63. |
MaxDecimalValue
Gets the max decimal value of color.
Declaration
public const uint MaxDecimalValue = null
Field Value
Type | Description |
---|---|
UInt32 |
Orange
Gets the orange color value.
Declaration
public static readonly Color Orange
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of E67E22. |
Purple
Gets the purple color value.
Declaration
public static readonly Color Purple
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 9B59B6. |
Red
Gets the red color value.
Declaration
public static readonly Color Red
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of E74C3C. |
Teal
Gets the teal color value.
Declaration
public static readonly Color Teal
Field Value
Type | Description |
---|---|
Color | A color struct with the hex value of 1ABC9C. |
Properties
| Improve this Doc View SourceB
Gets the blue component for this color.
Declaration
public readonly byte B { get; }
Property Value
Type | Description |
---|---|
Byte |
G
Gets the green component for this color.
Declaration
public readonly byte G { get; }
Property Value
Type | Description |
---|---|
Byte |
R
Gets the red component for this color.
Declaration
public readonly byte R { get; }
Property Value
Type | Description |
---|---|
Byte |
RawValue
Gets the encoded value for this color.
Declaration
public readonly uint RawValue { get; }
Property Value
Type | Description |
---|---|
UInt32 |
Remarks
This value is encoded as an unsigned integer value. The most-significant 8 bits contain the red value, the middle 8 bits contain the green value, and the least-significant 8 bits contain the blue value.
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
ToString()
Gets the hexadecimal representation of the color (e.g. #000ccc
).
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A hexadecimal string of the color. |
Operators
| Improve this Doc View SourceEquality(Color, Color)
Declaration
public static bool operator ==(Color lhs, Color rhs)
Parameters
Type | Name | Description |
---|---|---|
Color | lhs | |
Color | rhs |
Returns
Type | Description |
---|---|
Boolean |
Explicit(Drawing.Color to Color)
Declaration
public static explicit operator Color(Drawing.Color color)
Parameters
Type | Name | Description |
---|---|---|
Drawing.Color | color |
Returns
Type | Description |
---|---|
Color |
Implicit(Color to Drawing.Color)
Declaration
public static implicit operator Drawing.Color(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
Drawing.Color |
Implicit(Color to UInt32)
Declaration
public static implicit operator uint (Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
UInt32 |
Implicit(UInt32 to Color)
Declaration
public static implicit operator Color(uint rawValue)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | rawValue |
Returns
Type | Description |
---|---|
Color |
Inequality(Color, Color)
Declaration
public static bool operator !=(Color lhs, Color rhs)
Parameters
Type | Name | Description |
---|---|---|
Color | lhs | |
Color | rhs |
Returns
Type | Description |
---|---|
Boolean |