Skip to main content

Mapping and function for adding ANSI terminal colour escape sequences to strings for colour highlighting of output.

Function colourise(s, colour=None, uncolour='normal')

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(s, patterns, default_colour=None)

Colourise a string according to patterns.

  • 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(pattern, default_colour=None)

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(patterns, default_colour=None)

Convert an iterable of pattern specifications into a list of (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

Metadata

Release files for cs-ansi-colour 20180726

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cs-ansi-colour 20180726
File Size Uploaded Provenance Actions
cs.ansi_colour-20180726.tar.gz 2.7 kB Without provenance Details for cs.ansi_colour-20180726.tar.gz

Release files / cs.ansi_colour-20180726.tar.gz

Download URL cs.ansi_colour-20180726.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d8b6b897ca89972728de154a1e6706dd576e9685111f8e17abf8288660617fdc
BLAKE2b-256 checksum
How to use checksums
ab8040faf5783b2204fad791642ab91d9273ebd5abb9d5909e44ed52c1bc1635
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cs-ansi-colour 20180726

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page