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

[bug] When TERM is set to xterm, colors are not displaying properly #55

Open
lunrenyi opened this issue Oct 10, 2024 · 7 comments
Open

Comments

@lunrenyi
Copy link

  • I'm being used within a clean Ubuntu Docker image environment.
image
@jnd-au
Copy link
Contributor

jnd-au commented Oct 10, 2024

What is your real TERM in which you are running docker? Use -e TERM to provide your terminal type to docker. Otherwise, https://github.com/muesli/termenv detects the default value TERM=xterm as a generic non-colour terminal because the docker container doesn’t know your real environment.

@lunrenyi
Copy link
Author

In my Mac environment, TERM=xterm tz displays correctly, but it doesn't show up properly within a Docker Ubuntu image.

  • macOS
    image

  • docker Ubuntu image
    image

@jnd-au
Copy link
Contributor

jnd-au commented Oct 10, 2024

This suggests your macOS terminal environment has additional environment variables set (termenv detects these). Whereas docker run wipes the environment information by default, so differences should be expected. Normally, TERM=xterm tz on macOS is black-and-white, same as Docker.

@jnd-au
Copy link
Contributor

jnd-au commented Oct 10, 2024

Also, which version of tz -v are you using in each environment? (E.g. macOS Homebrew currently has version 0.7.0, but I’m not sure what you’re using within Docker.)

@lunrenyi
Copy link
Author

Also, which version of tz -v are you using in each environment? (E.g. macOS Homebrew currently has version 0.7.0, but I’m not sure what you’re using within Docker.)

They are all version 0.7.0, sourced from https://github.com/oz/tz/releases/tag/v0.7.0

@jnd-au
Copy link
Contributor

jnd-au commented Oct 10, 2024

I also have 0.7.0 and it works as expected: uncoloured with TERM=xterm, 16-colour with TERM=xterm-colour, and 256-colour with TERM=xterm-256color. The differences in your screenshots are probably due to the discrepancies between your environments. If you align your environments, you should see the same.

@jnd-au
Copy link
Contributor

jnd-au commented Oct 10, 2024

Hi @lunrenyi if you’re using iTerm, it sets some environment variables like COLORTERM=truecolor and TERM=xterm-256color which are different inside the Ubuntu Docker container, hence the discrepancy. If you pass your COLORTERM to docker, it will override TERM=xterm for colour detection, and tz will give you the result you expect: docker run -e COLORTERM .... Regards

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