Skip to content

ANSI escape codes (style, colour)ยค

We use ANSI escape codes to format documentation. You can type these in to your docstrings directly, or (more readable), you can also use the aliases we provide.

seali.RESET ยค

Place this in a string to reset all current styles and colours.

Stylesยค

Use within an f-string as f"...{seali.BOLD}red text here{seali.RESET}..." to set the style.

seali.BOLD ยค

seali.FAINT ยค

seali.ITALIC ยค

seali.UNDERLINE ยค

Colours (standard)ยค

Use within an f-string as f"...{seali.RED}red text here{seali.RESET}..." to set the foreground (text) colour.

Use as f"...{seali.RED.bg}..." to set the background colour.

Use as f"...{seali.RED.bright}..." to set the foreground (text) colour to the bright version of that colour.

Use as f"...{seali.RED.bright_bg}..." to set the background colour to the bright version of that colour.

seali.BLACK ยค

seali.RED ยค

seali.GREEN ยค

seali.YELLOW ยค

seali.BLUE ยค

seali.MAGENTA ยค

seali.CYAN ยค

seali.WHITE ยค

Colours (RGB)ยค

seali.RGB ยค

Create an ANSI colour of red/green/blue.

Use within an f-string as

colour = seali.RGB(r=10, g=255, b=45)
f"...{colour}coloured text here{seali.RESET}..."
to set the foreground (text) colour, and
colour = seali.RGB(r=10, g=255, b=45)
f"...{colour.bg}coloured background here{seali.RESET}..."
to set the background colour.

__init__(r: int, g: int, b: int) ยค

Arguments:

  • r: the amount of red, an integer from 0 to 255 inclusive.
  • g: the amount of green, an integer from 0 to 255 inclusive.
  • b: the amount of blue, an integer from 0 to 255 inclusive.