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 details)
Built Distribution
File details
Details for the file more_termcolor-1.1.3.tar.gz
.
File metadata
- Download URL: more_termcolor-1.1.3.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d4c193c6b680fff8cc676d7f43af6d53e49e5b89f0ad0a1ebe8b3ff5112ebf7 |
|
MD5 | 018875e45dd4b43cd6d671cb89732e55 |
|
BLAKE2b-256 | a98bcd7b302d5cdee965434901671c700e3a14b5d7c03b80929868bb14bd5989 |
File details
Details for the file more_termcolor-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: more_termcolor-1.1.3-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e0ad652159b20fbce3c52611d619a91bc66f9a7dde49bda76008b83349a6995 |
|
MD5 | 17930f6f81c3aaa72297046e243f4653 |
|
BLAKE2b-256 | 10cf951eeb24766da4178d5cb54c58e9991e7d94fb4422d058da4dd36ef3fbb9 |