Colour¶
discord_http.colour module¶
- class discord_http.colour.Color(value)¶
Bases:
ColourAlias for Colour.
- Parameters:
value (int)
- 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
- is_dark() bool¶
Returns whether the colour is considered dark based on perceived luminance.
- Return type:
- is_light() bool¶
Returns whether the colour is considered light based on perceived luminance.
- Return type:
- classmethod light_blurple() Self¶
Returns the light blurple branding colour of Discord.
- 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.
- to_hsl() tuple[int, int, int]¶
Returns the HSL (hue 0-360, saturation 0-100, lightness 0-100) values of the colour.
- to_hsv() tuple[int, int, int]¶
Returns the HSV (hue 0-360, saturation 0-100, value 0-100) values of the colour.
- class discord_http.colour.Colour(value)¶
Bases:
objectRepresents a colour object, used in multiple places in the API.
- Parameters:
value (int)
- is_dark() bool¶
Returns whether the colour is considered dark based on perceived luminance.
- Return type:
- is_light() bool¶
Returns whether the colour is considered light based on perceived luminance.
- Return type:
- to_hsl() tuple[int, int, int]¶
Returns the HSL (hue 0-360, saturation 0-100, lightness 0-100) values of the colour.
- to_hsv() tuple[int, int, int]¶
Returns the HSV (hue 0-360, saturation 0-100, value 0-100) values of the colour.
- 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.
- 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