Open PoiScript opened 6 years ago
Hello, thank you for your awesome works on
bat
!
Thank you for the feedback!
So it will be great the
bat
can provide an argument to overwirte the theme color e.g.bat --theme Tomorrow-Night --colors gutterForeground=f5f5f5 README.md
.
Sounds like a good idea to me.
I think it will be difficult to support this for every possible color that can be defined in a Sublime Syntax file (these would have to be looked up first), but we could start with the basic colors like gutterForeground
, yes. syntect
should allow us to easily modify those: https://docs.rs/syntect/2.1.0/syntect/highlighting/struct.ThemeSettings.html
As for the command-line option syntax, I'd suggest --set-theme-color gutterForeground f5f5f5 --set-theme-color foreground f0f0f0
. It's not like anyone is going to type these more than once anyway.
Thank you for your quick response. I also noticed that you're working on the configuration file now, so I suggest that you can add a command like bat config set gutterForeground f5f5f5
which will modify the configuration file automatically. So people don't have to type these long and long option every time.
A related problem: The "reverse" text from the bat theme obscures the highlighting of my search terms within my pager. A demonstration:
$ (BAT_PAGER=/usr/bin/less; bat --list-themes --color always |bat --paging always)
Then, hit G
to drop down to the bottom of the output, I've included screenshots from before and after I searched for the word "let". Don't see much difference except in the last two themes (TwoDark and zenburn).
I would like a flag and/or environment variable that would override the settings so that any coloring that the theme applies to the background would instead be applied to the foreground. Then the only reverse text in the output would be my search terms. Something along the lines of:
export BAT_THEME_STYLE=foreground
bat --theme-style foreground
And the screenshots:
@jetzerb bat
will never colorize the background. The background-colorized patches should actually be italic, but it seems like your terminal does not support that.
Can you please make sure that:
--italic-text=always
in the config file.@sharkdp: My apologies. I had been running v0.6.0. I've upgraded to 0.9.0 and now none of the text is showing up with a colored background. I'm not seeing any italics either though. and if I call bat with --italic-text=always
, some text shows in reverse, like the screenshots I included in my previous comment.
Oh, looks like this has something to do with tmux...If I detach from tmux, I see italic text instead of reverse text. Google leads me here. I'll have to investigate that...
Oh, looks like this has something to do with tmux...If I detach from tmux, I see italic text instead of reverse text. Google leads me here. I'll have to investigate that...
That's exactly the reason why we have decided to disable italics by default.
For anyone else who might have this problem... Per the tmux FAQ:
GNU screen does not support italics and the "screen" terminal description uses the italics escape sequence incorrectly.
As of tmux 2.1, if default-terminal is set to "screen" or matches "screen-*", tmux will behave like screen and italics will be disabled.
To enable italics, make sure you are using the tmux terminal description:
set -g default-terminal "tmux"
After setting the default terminal to "tmux", I can see colors, bold, italic, and reverse text. I'm using Oh My Tmux!. I'll see if the author has any thoughts on changing the default terminal from "screen-256color".
@jetzerb Thank you very much for quoting this here. We should add this to the https://github.com/sharkdp/bat#troubleshooting section in the README.
I'm using regular gnu screen and as with tmux, there's some weird issues with underlining.
This is gnu screen (no fixes), gnu screen (underline fixes) and regular terminal (no gnu screen) side by side:
I fixed my gnu screen underline issues using details from here: https://superuser.com/a/189503/92621 and added
# fix odd underlining and italic issues
attrcolor u "-u R"
attrcolor d -d
to my .screenrc
. I'm still not sure how to get the same colours with bat
inside gnu screen as you do without it (red versus orange, etc in the screenshot). It is compiled with 256 colour support.
@jaygooby Can you please open a new ticket for this? The whole discussion never really belonged here.
This might be related to COLORTERM=truecolor
still being set inside the screen session (because it was set by your terminal emulator?). You could try to unset
it inside the screen session.
I too would like to be able to customize the --highlight-line
color using a command line option.
Same here. I'm using theme "Visual Studio Dark+". And it practically doesn't highlight anything in windows terminal - the contrast is not noticeable.
Out of the box, using the "Solarized (dark)" theme, the highlight color is quite aggressive and makes the text difficult to read.
It does not matter if I set --italic-text=always
.
I'd like to understand where this color is coming from exactly. How can I patch it myself?
I'm pretty sure it's neither of my terminals and tmux also does not affect it. Can I have some pointers please? Thank you!
I'd like to understand where this color is coming from exactly.
How can I patch it myself?
I guess copy the tmTheme
file and follow the custom theme instructions
Ah, thanks @keith-hall, only now realised the themes are in git submodules :sweat_smile:
Looks like this value (#1CD1FF12
) defines opacity and I doubt terminals can handle that. Thanks again, I can take it from there.
Hello, thank you for your awesome works on
bat
! But I think there is a feature that still missing.Suppose that I just want to change the line number color, I have to make a copy of the theme file and change its
gutterForeground
value. And the theme file is verbose, normally 400+ lines.So it will be great the
bat
can provide an argument to overwirte the theme color e.g.bat --theme Tomorrow-Night --colors gutterForeground=f5f5f5 README.md
.