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

Commit 4af2de0 breaks coloring #69

Closed
klingtnet opened this issue Nov 16, 2019 · 4 comments
Closed

Commit 4af2de0 breaks coloring #69

klingtnet opened this issue Nov 16, 2019 · 4 comments

Comments

@klingtnet
Copy link

I use colored in a small tool that generates my shell prompt (rusty-prompt).
After updating colored from 1.8.0 to 1.9.0 I noticed that my shell prompt was not colored anymore, neither in bash nor in zsh. I then compiled rusty-prompt against all commits between 1.8.0 and 1.9.0 of colored and figured out that this commit broke the coloring for me: 4af2de0 .
The reason seems to be that colored now wrongly detects my terminal as TTY.

@klingtnet klingtnet changed the title No coloring since 4af2de0f095cc7a994d65e5d36dda60b7af25c82 anymore Commit 4af2de0 breaks coloring Nov 16, 2019
klingtnet added a commit to klingtnet/dotfiles that referenced this issue Nov 16, 2019
This requires CLICOLOR_FORCE to be set in the prompt because colored
now detects this as a TTY and refuses to add color escape codes.

See this issue for details:
colored-rs/colored#69
@kurtlawrence
Copy link
Collaborator

Hi @klingtnet

Could you please run the examples at atty and see what you get?

I cloned your repo, ran a cargo update and it is working fine for me, I tried both in bash and zsh, on ubuntu.

@klingtnet
Copy link
Author

The examples run fine and rusty-prompt also has colors when run as a simple command but not when it is executed to generate the shell prompt: https://github.com/klingtnet/dotfiles/blob/02c2bacd31b255afac8ee6a69ffb8279e876bc70/dots/.bashrc#L17

@kurtlawrence
Copy link
Collaborator

Hi @klingtnet

I see your issue now.

You can fix it by adding colored::control::set_override(true); to the top of your main function.

Below is my testing on your repo and it is working.

image

klingtnet pushed a commit to klingtnet/dotfiles that referenced this issue Nov 19, 2019
@klingtnet
Copy link
Author

Thank you very much, I can confirm that it works now!

klingtnet pushed a commit to klingtnet/termenv that referenced this issue Apr 3, 2020
This is useful when generating shell prompts because in this case the
TTY check fails but colors are supported.
Even though the link below is for a Rust library the problem is the same:
colored-rs/colored#69
klingtnet pushed a commit to klingtnet/termenv that referenced this issue Apr 3, 2020
This is useful when generating shell prompts because in this case the
TTY check fails but colors are supported.
Even though the link below is for a Rust library the problem is the same:
colored-rs/colored#69
klingtnet pushed a commit to klingtnet/termenv that referenced this issue Apr 3, 2020
This is useful when generating shell prompts because in this case the
TTY check fails but colors are supported.
Even though the link below is for a Rust library the problem is the same:
colored-rs/colored#69
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