Color Support

New in version 1.2.1.

Module to help display color on the command line of ANSI-compliant termainals.

..versionadded:: 1.2.1

lsl.common.color.colorfy(text)

Given a string encoded with color and/or style information, return a string with embedded ANSI terminal codes. For example: {{%red text}} {{%underline underline}} will return the text ‘text underline’ with ‘text’ displayed as red and ‘underline’ underlined.

Valid colors are:
  • black

  • red

  • green

  • yellow

  • blue

  • magenta

  • cyan

  • white

Valid type styles are:
  • bold

  • underline

  • blink

  • reverse

Note

Background colors can be set by appending ‘bkg-‘ to the color name.