kennethreitz / kennethreitz/crayons
embedded colored strings unset outer colored string
- Dominant language
- Python
- Stars
- 417
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Situations like this (or [here in pipenv](https://github.com/kennethreitz/pipenv/blob/dba68e00f4734d07881d51173c03c27089dc41af/pipenv/cli.py#L985)):
```python
print(crayons.blue('horses, like {0}, eat grass too'.format(crayons.red('goats'))))
```
produce the following in Python 3.6.2:

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

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

Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the nested crayons.blue and crayons.red example from the issue in Python 3.6.2 and compare its terminal output with the expected screenshots. Trace how the outer color is emitted and restored around embedded colored text, then add a regression test showing that text after the nested color remains blue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100