kennethreitz / kennethreitz/crayons

embedded colored strings unset outer colored string

Open
#9 3 comments 1 reaction 0 assignees View on GitHub
question
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:
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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.