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

White text color on white background terminal #1676

Closed
alexandre1985 opened this issue Jun 1, 2021 · 9 comments
Closed

White text color on white background terminal #1676

alexandre1985 opened this issue Jun 1, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@alexandre1985
Copy link

Describe the bug you encountered:
bat prints white text color on white background terminal
...

What did you expect to happen instead?
Expect to be like cat and, in these circunstances, print black text color
...

How did you install bat?

pacman

bat version and environment

bat 0.18.1

ArchLinux

@alexandre1985 alexandre1985 added the bug Something isn't working label Jun 1, 2021
@alexandre1985
Copy link
Author

@sharkdp
Copy link
Owner

sharkdp commented Jun 1, 2021

Could you please post the output of bat --diagnostic? Also, please read https://github.com/sharkdp/bat#highlighting-theme

@alexandre1985
Copy link
Author

alexandre1985 commented Jun 2, 2021

I already added a theme. It would be cool if it worked like cat and detect the terminal background color and ajust to it.
Either way, here it is:

Software version

bat 0.18.1 (3aea514)

Operating system

Linux 5.10.41-1-lts

Command-line

bat --diagnostic 

Environment variables

SHELL=/bin/bash
PAGER=<not set>
LESS=<not set>
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=/home/daniel/.config
XDG_CACHE_HOME=/home/daniel/.cache
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>

Config file

--theme="Solarized (light)"

Compile time information

  • Profile: release
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

Less version

> less --version 
less 581.2 (PCRE2 regular expressions)
Copyright (C) 1984-2021  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

@sharkdp
Copy link
Owner

sharkdp commented Jun 14, 2021

You can try to do something like this: https://github.com/sharkdp/bat#dark-mode

There is also an issue somewhere on this repository with a solution for bash, if I remember correctly.

@alexandre1985
Copy link
Author

Thank you.
I have set a theme manually and I am sticking with it

@daramir
Copy link

daramir commented Jul 5, 2022

You can try to do something like this: https://github.com/sharkdp/bat#dark-mode

@sharkdp I've been unable to use the dark mode instructions as part of a bat config file. Could you please share the right way to do it? Could be a syntax problem on my end, or a limitation of the config logic?

I'd like to avoid using the alias method. Thanks.

@Enselic
Copy link
Collaborator

Enselic commented Jul 5, 2022

If you want it would be great if you could try the git master branch. In git master (and in the next release) bat will auto-detect macOS dark mode out of the box.

The PR is this one: #2197

@ghost
Copy link

ghost commented Jul 1, 2023

I put this into my .bashrc.
Worked for me.

export BAT_THEME="GitHub"

@stellarpower
Copy link

I am admittedly on an old version of bat currently, but this stopped me usin it some time ago and not looked back until now.

If I list the themes like so:
bat --list-themes

image

Many of the light themes look very nice; but, it seems they're light themes but are outputting text in a light colour expecting a dark background, when I have my terminal set to light mode, as I do on all programs I use, so I can read it without the chances of eye cancer.

I don't know if it's possible to detect the background colour of a terminal emulator portably, and reliably enough that it'll work, but I'm guessing that the colour scheme in this case is using a fixed colour for the text irrespective of the background. I'll just change themes for now, as some of them do render nicely, but if it would be possible to apply logic depending on the colour of the terminal's background, I guess that'd be an ideal solution. Or may be a pain in the arse, but perhaps a light-light theme and a light-dark theme - i.e. the themes can show text in light but one where the terminal is set up as dark, and one if the terminal is set up as light. Hopefully most colours wouldn't need to be changed - the syntax highlighting looks nice, but it's plain text that renders as white-on-white for me, when it ought to be black-on-white.

Thanks 🦇 🐈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants