util.termcolours

Utility for producing colourful terminal output. Mainly used for console logging. Limited Windows support.

List of styles

getstyle

getstyle takes a list of colour names or styles and returns the codes for later use with other functions.

getstring

Takes a colour code from getstyle and some text returns a string with the appropriate ANSI escape codes so that it gets coloured when printed. It also adds the reset escape code so that following output are shown as normal.

setstyle

Takes a colour code from getstyle and writes it to standard output, so that later output uses this code. Be sure to use the "reset" style to revert back to the default colours.

tohtml

Turns coloured from getstring text into HTML.

Examples