crayons icon indicating copy to clipboard operation
crayons copied to clipboard

embedded colored strings unset outer colored string

Open andy-esch opened this issue 6 years ago • 3 comments

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

andy-esch avatar Aug 30 '17 19:08 andy-esch

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

scientifichackers avatar Mar 20 '18 12:03 scientifichackers

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

ulgens avatar Apr 17 '18 02:04 ulgens

Just use RichConsole.py

KOLANICH avatar May 23 '19 07:05 KOLANICH