kennethreitz / crayons

Text UI colors for Python.
https://pypi.python.org/pypi/crayons
MIT License
424 stars 30 forks source link

embedded colored strings unset outer colored string #9

Open andy-esch opened 7 years ago

andy-esch commented 7 years ago

Situations like this (or here in pipenv):

print(crayons.blue('horses, like {0}, eat grass too'.format(crayons.red('goats'))))

produce the following in Python 3.6.2:

screen shot 2017-08-30 at 15 43 41

To me, the expectation is that embedded colored text would not effect the coloring outside of there, so you'd get the following instead:

screen shot 2017-08-30 at 15 46 03

I spotted this after spawning a virtualenv shell from pipenv :) Notice closing parenthesis:

screen shot 2017-08-30 at 15 38 13
scientifichackers commented 6 years ago

Can this fix also be issued for fstrings? So it's possible to do something like this crayons.green(f'should be green {crayons.blue("should be blue")} should be green ')

image

ulgens commented 6 years ago

@kennethreitz Don't you like this repo anymore? :disappointed:

KOLANICH commented 5 years ago

Just use RichConsole.py