Bat: Color theme should take background color into account

Created on 2 Sep 2018  路  5Comments  路  Source: sharkdp/bat

I use different terminals, some with black font on light background, others with white font on black background. It is very hard to read the output of several themes on terminals with light background colour. It would be helpful if bat could autodetect this and invert colors (or give the printed lines a background color.

question themes

Most helpful comment

I have tried that, but it looks terrible because the background color changes in the middle of your terminal session. I wouldn't want any CLI program to do that. You also need to do things like filling short lines with spaces just to "draw" the background color.

All 5 comments

I don't think there is a reliable way to detect the terminals background color (https://stackoverflow.com/questions/2507337/is-there-a-way-to-determine-a-terminals-background-color), so this is probably not going to happen.

So the way to go would be to explicitly set the background color for each line.
Anyway, thanks a lot for your work!

I have tried that, but it looks terrible because the background color changes in the middle of your terminal session. I wouldn't want any CLI program to do that. You also need to do things like filling short lines with spaces just to "draw" the background color.

can you add a light/dark flag to control the theme? I use solarized light and white text is unusable on it

update:
try bat --list-themes to see themes you may like, for me GitHub and Monokai Extended Light work.
use like bat --theme GitHub file.txt

@morenoh149 Please take a look at all the themes in bat --list-themes. There are many themes for light terminal schemes (GitHub, Monokai Extended Light, OneHalfLight). Then just use --theme or the BAT_THEME environment variable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adamtabrams picture adamtabrams  路  3Comments

x70b1 picture x70b1  路  3Comments

niedzielski picture niedzielski  路  3Comments

jkaan picture jkaan  路  3Comments

yannallain picture yannallain  路  3Comments