Show / Hide Table of Contents

# Struct Color

Represents a color used in Discord.

##### Inherited Members

System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()

###### Namespace: Discord

###### Assembly: Discord.Net.Core.dll

##### Syntax

    public struct Color

### Constructors

| Improve this Doc View Source

#### Color(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
--- | --- | ---
System.Byte | r | The byte that represents the red color.
System.Byte | g | The byte that represents the green color.
System.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
--- | --- | ---
System.Int32 | r | The value that represents the red color. Must be within 0~255.
System.Int32 | g | The value that represents the green color. Must be within 0~255.
System.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);

##### Exceptions

Type | Condition
--- | ---
System.ArgumentOutOfRangeException | The argument value is not between 0 to 255.

| 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
--- | --- | ---
System.Single | r | The value that represents the red color. Must be within 0~1.
System.Single | g | The value that represents the green color. Must be within 0~1.
System.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);

##### Exceptions

Type | Condition
--- | ---
System.ArgumentOutOfRangeException | The argument value is not between 0 to 1.

| 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
--- | --- | ---
System.UInt32 | rawValue | The raw value of the color (e.g. `0x607D8B`).

##### Examples

The following will create a color that has a hex value of #607D8B.

    Color darkGrey = new Color(0x607D8B);

### Fields

| Improve this Doc View Source

#### Blue

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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### Default

Gets the default user color value.

##### Declaration

    public static readonly Color Default

##### Field Value

Type | Description
--- | ---
Color |

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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 Source

#### B

Gets the blue component for this color.

##### Declaration

    public byte B { get; }

##### Property Value

Type | Description
--- | ---
System.Byte |

| Improve this Doc View Source

#### G

Gets the green component for this color.

##### Declaration

    public byte G { get; }

##### Property Value

Type | Description
--- | ---
System.Byte |

| Improve this Doc View Source

#### R

Gets the red component for this color.

##### Declaration

    public byte R { get; }

##### Property Value

Type | Description
--- | ---
System.Byte |

| Improve this Doc View Source

#### RawValue

Gets the encoded value for this color.

##### Declaration

    public uint RawValue { get; }

##### Property Value

Type | Description
--- | ---
System.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 Source

#### Equals(Object)

##### Declaration

    public override bool Equals(object obj)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | obj |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

System.ValueType.Equals(System.Object)
| Improve this Doc View Source

#### GetHashCode()

##### Declaration

    public override int GetHashCode()

##### Returns

Type | Description
--- | ---
System.Int32 |

##### Overrides

System.ValueType.GetHashCode()
| Improve this Doc View Source

#### ToString()

Gets the hexadecimal representation of the color (e.g. `#000ccc`).

##### Declaration

    public override string ToString()

##### Returns

Type | Description
--- | ---
System.String | A hexadecimal string of the color.

##### Overrides

System.ValueType.ToString()

### Operators

| Improve this Doc View Source

#### Equality(Color, Color)

##### Declaration

    public static bool operator ==(Color lhs, Color rhs)

##### Parameters

Type | Name | Description
--- | --- | ---
Color | lhs |
Color | rhs |

##### Returns

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### Explicit(Color to Color)

##### Declaration

    public static explicit operator Color(Color color)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Drawing.Color | color |

##### Returns

Type | Description
--- | ---
Color |

| Improve this Doc View Source

#### Implicit(Color to Color)

##### Declaration

    public static implicit operator Color(Color color)

##### Parameters

Type | Name | Description
--- | --- | ---
Color | color |

##### Returns

Type | Description
--- | ---
System.Drawing.Color |

| Improve this Doc View Source

#### Inequality(Color, Color)

##### Declaration

    public static bool operator !=(Color lhs, Color rhs)

##### Parameters

Type | Name | Description
--- | --- | ---
Color | lhs |
Color | rhs |

##### Returns

Type | Description
--- | ---
System.Boolean |