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
Default theme broken on default config of Terminal.app (OS X) #328
Comments
Thank you for your feedback. This is unfortunate, but there is no reasonable way to check whether the user is on a terminal with a dark or a light background color. I don't think there's a color scheme that would work equally well on dark and light backgrounds, so I don't think there is a way to "fix" this.
Yes. We want What do you think? Maybe we should mention this in the README somewhere? |
Yeah, I think that mentioning in the README would be great. I think the key points are:
I do think that it's important to recommend a specific theme in number 2 just to reduce friction |
I run into this "bug" and thought that it was an issue with bat, then I tried in another computer and understood my mistake... 😑 I just tested with Vim, and it is able to change the color of the font. A text reset for the "white" code could be enough. The most complete fix would be to use xterm control sequence to change the the according to the background, but it may be overkill. A quick fix would be to use a very light gray instead of white, so the user could at least understand what is the issue. Very nice BTW 👍 |
What is "a reset for the white code"?
What does that mean? |
The reset code is '\033[0m'. It reset all the styles, including the text color. [1] The text will be in white on a black background, and in black on a white background. It should be put at the end of the styled section so it doesn't impact what is after. Ansi_term seems to do the reset at the end of paint(), so println or Style::default().paint should be enough. For xterm control sequences I was thinking of [2], but it doesn't work on Mac terminal and others. I looked at Vim [3], and they check the name of some terminals and the env variable $COLORFGBG, which is not defined by many terminals (incl. Mac and iterm2). This combo terminal detection/$COLORFGBG is used by others [4], but it's fragile (su - doesn't propagate the env variables, non-default color on terminal without COLORFGBG...). I didn't imagine something as simple as detecting the background color could be so complicated! [1] https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux/28938235#28938235 |
Oh, The problem is that even the "normal text" is painted with a particular color (white or very bright) because that is the way the color scheme is meant to be used. I wouldn't want to change white text to "no color" because some people use green fonts on a dark background and this would spoil their bat experience. |
Not sure if this is something that you're planning to fix but bat is broken by default on OS X. Not sure what the best fix would be, but my first thought is for the default theme (not sure which one it is since
bat --list-themes
does not tell you the default) should work reasonably with both a black and a white background (although maybe that's too difficult). As far as I can tell the default theme emits some text that is completely white, which makes the default config of bat unusable on a white background.The text was updated successfully, but these errors were encountered: