Colour

discord_http.colour module

class discord_http.colour.Color(value)

Bases: Colour

Alias for Colour.

Parameters:

value (int)

classmethod alizarin() Self

Returns the alizarin colour.

Return type:

Self

classmethod amethyst() Self

Returns the amethyst colour.

Return type:

Self

property b: int

The blue component of the colour.

classmethod belize_hole() Self

Returns the belize hole colour.

Return type:

Self

classmethod blue_sentinel() Self

Returns the blue sentinel colour.

Return type:

Self

classmethod blurple() Self

Returns the blurple branding colour of Discord.

Return type:

Self

property brightness: int

The perceived brightness of the colour (0-255).

classmethod carrot() Self

Returns the carrot colour.

Return type:

Self

classmethod default() Self

Returns the default colour (#000000, Black).

Return type:

Self

classmethod dusty_sky() Self

Returns the dusty sky colour.

Return type:

Self

classmethod emerald() Self

Returns the emerald colour.

Return type:

Self

classmethod from_cmyk(c, m, y, k) Self

Creates a Colour object from CMYK values.

Parameters:
  • c (int) – Cyan (0-100)

  • m (int) – Magenta (0-100)

  • y (int) – Yellow (0-100)

  • k (int) – Key/black (0-100)

Return type:

Self

Returns:

The colour object

classmethod from_hex(hex_value) Self

Creates a Colour object from a hex string.

Parameters:

hex_value (str) – The hex string to convert

Return type:

Self

Returns:

The colour object

Raises:

ValueError – Invalid hex colour

classmethod from_hsl(h, s, l) Self

Creates a Colour object from HSL values.

Parameters:
  • h (int) – Hue (0-360)

  • s (int) – Saturation (0-100)

  • l (int) – Lightness (0-100)

Return type:

Self

Returns:

The colour object

classmethod from_hsv(h, s, v) Self

Creates a Colour object from HSV values.

Parameters:
  • h (int) – Hue (0-360)

  • s (int) – Saturation (0-100)

  • v (int) – Value (0-100)

Return type:

Self

Returns:

The colour object

classmethod from_rgb(r, g, b) Self

Creates a Colour object from RGB values.

Parameters:
  • r (int) – Red value

  • g (int) – Green value

  • b (int) – Blue value

Return type:

Self

Returns:

The colour object

property g: int

The green component of the colour.

classmethod green_sea() Self

Returns the green sea colour.

Return type:

Self

classmethod harrison_grey() Self

Returns the harrison grey colour.

Return type:

Self

is_dark() bool

Returns whether the colour is considered dark based on perceived luminance.

Return type:

bool

is_light() bool

Returns whether the colour is considered light based on perceived luminance.

Return type:

bool

classmethod light_blurple() Self

Returns the light blurple branding colour of Discord.

Return type:

Self

classmethod mellow_melon() Self

Returns the mellow melon colour.

Return type:

Self

classmethod nephritis() Self

Returns the nephritis colour.

Return type:

Self

classmethod orange() Self

Returns the orange colour.

Return type:

Self

classmethod peter_river() Self

Returns the peter river colour.

Return type:

Self

classmethod plum_perfect() Self

Returns the plum perfect colour.

Return type:

Self

classmethod pomegranate() Self

Returns the pomegranate colour.

Return type:

Self

classmethod pumpkin() Self

Returns the pumpkin colour.

Return type:

Self

property r: int

The red component of the colour.

classmethod random(*, seed=None) Self

Creates a random colour.

Parameters:

seed (str | None) – The seed to use for the random colour to make it deterministic

Return type:

Self

Returns:

The random colour

classmethod sun_flower() Self

Returns the sun flower colour.

Return type:

Self

to_cmyk() tuple[int, int, int, int]

Returns the CMYK (cyan 0-100, magenta 0-100, yellow 0-100, key/black 0-100) values of the colour.

Return type:

tuple[int, int, int, int]

to_hex() str

Returns the hex value of the colour.

Return type:

str

to_hsl() tuple[int, int, int]

Returns the HSL (hue 0-360, saturation 0-100, lightness 0-100) values of the colour.

Return type:

tuple[int, int, int]

to_hsv() tuple[int, int, int]

Returns the HSV (hue 0-360, saturation 0-100, value 0-100) values of the colour.

Return type:

tuple[int, int, int]

to_rgb() tuple[int, int, int]

Returns the RGB values of the colour`.

Return type:

tuple[int, int, int]

classmethod turquoise() Self

Returns the turquoise colour.

Return type:

Self

value: int

The integer value of the colour, between 0 and 16777215 (0xFFFFFF).

classmethod whale_shark() Self

Returns the whale shark colour.

Return type:

Self

classmethod wisteria() Self

Returns the wisteria colour.

Return type:

Self

class discord_http.colour.Colour(value)

Bases: object

Represents a colour object, used in multiple places in the API.

Parameters:

value (int)

value: int

The integer value of the colour, between 0 and 16777215 (0xFFFFFF).

property r: int

The red component of the colour.

property g: int

The green component of the colour.

property b: int

The blue component of the colour.

property brightness: int

The perceived brightness of the colour (0-255).

is_dark() bool

Returns whether the colour is considered dark based on perceived luminance.

Return type:

bool

is_light() bool

Returns whether the colour is considered light based on perceived luminance.

Return type:

bool

to_rgb() tuple[int, int, int]

Returns the RGB values of the colour`.

Return type:

tuple[int, int, int]

to_hex() str

Returns the hex value of the colour.

Return type:

str

to_hsl() tuple[int, int, int]

Returns the HSL (hue 0-360, saturation 0-100, lightness 0-100) values of the colour.

Return type:

tuple[int, int, int]

to_hsv() tuple[int, int, int]

Returns the HSV (hue 0-360, saturation 0-100, value 0-100) values of the colour.

Return type:

tuple[int, int, int]

to_cmyk() tuple[int, int, int, int]

Returns the CMYK (cyan 0-100, magenta 0-100, yellow 0-100, key/black 0-100) values of the colour.

Return type:

tuple[int, int, int, int]

classmethod from_rgb(r, g, b) Self

Creates a Colour object from RGB values.

Parameters:
  • r (int) – Red value

  • g (int) – Green value

  • b (int) – Blue value

Return type:

Self

Returns:

The colour object

classmethod from_hex(hex_value) Self

Creates a Colour object from a hex string.

Parameters:

hex_value (str) – The hex string to convert

Return type:

Self

Returns:

The colour object

Raises:

ValueError – Invalid hex colour

classmethod from_hsl(h, s, l) Self

Creates a Colour object from HSL values.

Parameters:
  • h (int) – Hue (0-360)

  • s (int) – Saturation (0-100)

  • l (int) – Lightness (0-100)

Return type:

Self

Returns:

The colour object

classmethod from_hsv(h, s, v) Self

Creates a Colour object from HSV values.

Parameters:
  • h (int) – Hue (0-360)

  • s (int) – Saturation (0-100)

  • v (int) – Value (0-100)

Return type:

Self

Returns:

The colour object

classmethod from_cmyk(c, m, y, k) Self

Creates a Colour object from CMYK values.

Parameters:
  • c (int) – Cyan (0-100)

  • m (int) – Magenta (0-100)

  • y (int) – Yellow (0-100)

  • k (int) – Key/black (0-100)

Return type:

Self

Returns:

The colour object

classmethod default() Self

Returns the default colour (#000000, Black).

Return type:

Self

classmethod random(*, seed=None) Self

Creates a random colour.

Parameters:

seed (str | None) – The seed to use for the random colour to make it deterministic

Return type:

Self

Returns:

The random colour

classmethod blurple() Self

Returns the blurple branding colour of Discord.

Return type:

Self

classmethod light_blurple() Self

Returns the light blurple branding colour of Discord.

Return type:

Self

classmethod turquoise() Self

Returns the turquoise colour.

Return type:

Self

classmethod green_sea() Self

Returns the green sea colour.

Return type:

Self

classmethod emerald() Self

Returns the emerald colour.

Return type:

Self

classmethod nephritis() Self

Returns the nephritis colour.

Return type:

Self

classmethod peter_river() Self

Returns the peter river colour.

Return type:

Self

classmethod belize_hole() Self

Returns the belize hole colour.

Return type:

Self

classmethod amethyst() Self

Returns the amethyst colour.

Return type:

Self

classmethod wisteria() Self

Returns the wisteria colour.

Return type:

Self

classmethod mellow_melon() Self

Returns the mellow melon colour.

Return type:

Self

classmethod plum_perfect() Self

Returns the plum perfect colour.

Return type:

Self

classmethod sun_flower() Self

Returns the sun flower colour.

Return type:

Self

classmethod orange() Self

Returns the orange colour.

Return type:

Self

classmethod carrot() Self

Returns the carrot colour.

Return type:

Self

classmethod pumpkin() Self

Returns the pumpkin colour.

Return type:

Self

classmethod alizarin() Self

Returns the alizarin colour.

Return type:

Self

classmethod pomegranate() Self

Returns the pomegranate colour.

Return type:

Self

classmethod dusty_sky() Self

Returns the dusty sky colour.

Return type:

Self

classmethod harrison_grey() Self

Returns the harrison grey colour.

Return type:

Self

classmethod whale_shark() Self

Returns the whale shark colour.

Return type:

Self

classmethod blue_sentinel() Self

Returns the blue sentinel colour.

Return type:

Self