Search Results for

    Show / Hide Table of Contents

    Struct Color

    Represents a color used in Discord.

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

    MaxDecimalValue

    Gets the max decimal value of color.

    Declaration
    public const uint MaxDecimalValue = null
    Field Value
    Type Description
    UInt32
    | 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 readonly byte B { get; }
    Property Value
    Type Description
    Byte
    | Improve this Doc View Source

    G

    Gets the green component for this color.

    Declaration
    public readonly byte G { get; }
    Property Value
    Type Description
    Byte
    | Improve this Doc View Source

    R

    Gets the red component for this color.

    Declaration
    public readonly byte R { get; }
    Property Value
    Type Description
    Byte
    | Improve this Doc View Source

    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 Source

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    | Improve this Doc View Source

    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 Source

    Equality(Color, Color)

    Declaration
    public static bool operator ==(Color lhs, Color rhs)
    Parameters
    Type Name Description
    Color lhs
    Color rhs
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    Explicit(System.Drawing.Color to Color)

    Declaration
    public static explicit operator Color(System.Drawing.Color color)
    Parameters
    Type Name Description
    System.Drawing.Color color
    Returns
    Type Description
    Color
    | Improve this Doc View Source

    Implicit(Color to System.Drawing.Color)

    Declaration
    public static implicit operator System.Drawing.Color(Color color)
    Parameters
    Type Name Description
    Color color
    Returns
    Type Description
    System.Drawing.Color
    | Improve this Doc View Source

    Implicit(Color to UInt32)

    Declaration
    public static implicit operator uint (Color color)
    Parameters
    Type Name Description
    Color color
    Returns
    Type Description
    UInt32
    | Improve this Doc View Source

    Implicit(UInt32 to Color)

    Declaration
    public static implicit operator Color(uint rawValue)
    Parameters
    Type Name Description
    UInt32 rawValue
    Returns
    Type Description
    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
    Boolean

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.7.2