Colour

discord_http.colour module

class discord_http.colour.Color(value: int)[source]

Bases: Colour

Alias for Colour

class discord_http.colour.Colour(value: int)[source]

Bases: object

property b: int

Returns the blue component of the colour

Type:

int

classmethod default() Self[source]

Colour: Returns the default colour (#000000, Black)

classmethod from_hex(hex: str) Self[source]

Creates a Colour object from a hex string

Parameters:

hex (str) – The hex string to convert

Returns:

The colour object

Return type:

Colour

Raises:

ValueError – Invalid hex colour

classmethod from_rgb(r: int, g: int, b: int) Self[source]

Creates a Colour object from RGB values

Parameters:
  • r (int) – Red value

  • g (int) – Green value

  • b (int) – Blue value

Returns:

The colour object

Return type:

Colour

property g: int

Returns the green component of the colour

Type:

int

property r: int

Returns the red component of the colour

Type:

int

classmethod random(*, seed: Any | None = None) Self[source]

Creates a random colour

Parameters:

seed (Optional[Any]) – The seed to use for the random colour to make it deterministic

Returns:

The random colour

Return type:

Colour

to_hex() str[source]

str: Returns the hex value of the colour

to_rgb() tuple[int, int, int][source]

tuple[int, int, int]: Returns the RGB values of the colour`