Module constyle.custom_colours
This module contains classes to create foreground and background attributes which apply custom colours.
Custom colours have less support than standard colours, so it's recommended to prefer standard colours if possible.
Classes
class EightBit (value: int, background: bool = False)
-
This class allows you to make attributes for custom foreground and background colours using an 8-bit value.
Args
value
- The 8-bit value of the colour (0 to 255). - 0-7: Standard colours. - 8-15: Bright colours. - 16-231: RGB values from 0 to 5. Calculated as 16 + (36 * red) + (6 * green) + (blue). - 232-255: Grays values. 232 is darkest and 255 is lightest.
Raises
ValueError
- If the 8-bit value is not between 0 and 255.
Ancestors
- constyle._style.Style
Subclasses
class EightBitRGB (red: int, green: int, blue: int, background: bool = False)
-
This class facilitates the creation of custom 8-bit colours using RGB values.
The colour won't be exact, but it will be as close as possible for 8-bit colours. The closer the RGB values are to a multiple of 256/6, the more accurate the colour will be.
Args
red
- The red value of the colour (0-255).
green
- The green value of the colour (0-255).
blue
- The blue value of the colour (0-255).
background
- Whether this is a foreground or background colour. Defaults to foreground.
Raises
ValueError
- If the red, green or blue values are not between 0 and 255.
Ancestors
- EightBit
- constyle._style.Style
class RGB (red: int, green: int, blue: int, background: bool = False)
-
This class allows you to make attributes for custom foreground and background colours using RGB values.
Args
red
- The red value of the colour (0-255).
green
- The green value of the colour (0-255).
blue
- The blue value of the colour (0-255).
background
- Whether this is a foreground or background colour. Defaults to foreground.
Raises
ValueError
- If the red, green or blue values are not between 0 and 255.
Ancestors
- constyle._style.Style