Skip to main content

All colors, with support for nested colors, convenience methods and full original termcolor compatability.

Project description

more_termcolor

Pass unlimited number of colors, color-codes, or attributes

All standard, background, bright, or attribute codes are available (or any combination of them)
Intelligently handles existing colors in the text as to allow adding or combining colors automatically, while ensuring the smallest string size possible

Convenience methods that expose shortcuts to common values (bold('foo'), yellow('bar') etc)
100% compatible with the classic termcolor lib: anything that works with termcolor works the same with more_termcolor

Example

# This is also possible:
from more_termcolor.colors import bold, brightgreen
bold_text = bold('text')
fancy = brightgreen(f'this whole string, including this {bold_text} is bright green')
>>> this whole string, including this text is bright red

Roadmap (work in progress)

- Parse complex color args, such as:
cprint('foo', 'bold bright blue on black')
>>> foo
- pygments-like support for pseudo HTML tags, e.g.:
text = "<magenta>some text<on yellow>that shows</on yellow>what's <bold ul>planned</bold ul></magenta>"
cprint(text) 
>>> some text that shows what's planned
- Custom tags:
text = "<m>some text<oy>that shows</oy>what's <bu>planned</bu></m>"
cprint(text, m='magenta', oy='on yellow', bu='bold ul') 
>>> some text that shows what's planned
- Colorize by regex:
stuff = {'food': 'pizza', 'love': 'wife'}
cprint(stuff, bold=r"'\w+':")
>>> {'food': 'pizza', 'love': 'wife'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

more_termcolor-1.1.3.tar.gz (12.9 kB view hashes)

Uploaded Source

Built Distribution

more_termcolor-1.1.3-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page