Mapping and function for adding ANSI terminal colour escape sequences to strings for colour highlighting of output.
Function colourise
Return a string enclosed in colour-on and colour-off ANSI sequences.
colour names the desired ANSI colour.
uncolour may be used to specify the colour-off colour;
the default is 'normal'.
Function colourise_patterns
Colourise a string according to regular expressions.
s: the string
patterns: a sequence of patterns
default_colour: if a string pattern has no colon, or starts
with a colon, use this colour; default DEFAULT_HIGHLIGHT
Each pattern may be:
a string of the form "[colour]:regexp"
a string containing no colon, taken to be a regexp
a tuple of the form (colour, regexp)
a regexp object
Returns the string with ANSI colour escapes embedded.
Function make_pattern
Convert a pattern specification into a (colour, regexp) tuple. Each pattern may be: a string of the form "[colour]:regexp" a string containing no colon, taken to be a regexp a tuple of the form (colour, regexp) a regexp object
Function make_patterns
Convert an iterable of pattern specifications into a list if (colour, regexp) tuples. Each pattern may be: a string of the form "[colour]:regexp" a string containing no colon, taken to be a regexp a tuple of the form (colour, regexp) a regexp object
Release files for cs-ansi-colour 20180725
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cs.ansi_colour-20180725.tar.gz | 2.7 kB | Details |
Release files / cs.ansi_colour-20180725.tar.gz
| Download URL | cs.ansi_colour-20180725.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fca23b417174e651747d131b6bbfe3ade01beac3354f1f5bfb728277e12e75ee
|
|
BLAKE2b-256 checksum How to use checksums |
8ce9db40387f21b89eb748042425f48ae661e7e20e90686d2bda510a4d4d46d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |