Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt colors shown as ANSI color code #804

Closed
edouard-lopez opened this issue Mar 16, 2019 · 2 comments
Closed

Prompt colors shown as ANSI color code #804

edouard-lopez opened this issue Mar 16, 2019 · 2 comments

Comments

@edouard-lopez
Copy link
Contributor

related: timofurrer/colorful#26


When running in a docker I get ANSI colour code instead of the color should get thanks to colorful module.

❯ docker run \
     --name run-pure-on-elvish \
     --rm \
     --interactive \
     --tty \
     --volume=$PWD:/home/nemo/.pure/ \
     pure-on-elvish-latest
^[[38;2;173;216;230m/home/pure/.pure^[[39m^[[26m
^[[38;2;190;190;190mmaster^[[39m^[[26m^[[38;2;190;190;190m*^[[39m^[[26m
^[[38;2;205;0;0m❯^[[39m^[[26m

However if in said container I run a Python3 prompt, it works fine:

$ python3
Python 3.6.8 (default, Jan 24 2019, 16:36:30)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import colorful
>>> print(colorful.red('red {0} red'.format(colorful.white('white'))))
red white red  <---------------- colored adequatly

I tried to force color in my container using -e TERM=xterm-256color without success.

@SolitudeSF
Copy link
Contributor

okay, i kinda misled you, you actually need to pipe your prompt to terminal with
>/dev/tty. i just did edit:prompt = { python3 prompt.py >/dev/tty } and it now displays properly.

@edouard-lopez
Copy link
Contributor Author

@SolitudeSF it solve the colors issue but I got an extra newline not present in other shells, see #805

edouard-lopez added a commit to edouard-lopez/pure.py that referenced this issue Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants