-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add 3 new themes: ansi-light, ansi-dark, base16 #543
Conversation
Thank you very much, this looks really great! It will take me a few days before I can properly review this, as I'm currently on vacation. |
Just updated the theme files after realizing the gutter settings were specified incorrectly. One thing that just occurred to me: since I'm enabling |
Author of syntect here, I approve of this method of doing ANSI themes with syntect. One idea I thought of and posted in the associated issue is to use the alpha channel to select between rendering as ansi and rendering as RGB. It's possible to specify the alpha channel in TextMate themes using longer hex codes, and an alpha of zero (transparent) could be used as a special signifier of an ANSI color. |
Yes, I think I'll try doing it with the alpha channel instead. Advantages:
|
Also, interpret transparent colors (#RRGGBB00) as specifying a terminal color palette number with RR. The three new themes use this.
I've pushed the new, much simpler changes. The old version is in the Again, I'm not sure how you're supposed to add a built-in theme to the repository's |
Very cool, thank you for the new implementation!
I will do that when I release the next version. |
Thanks a lot, that’s perfect! |
This will automatically adjust to whatever has been defined in my terminal color scheme. See: - sharkdp/bat#543
Fixes #490
To summarize that issue: some people change their color theme often, perhaps switching between a light theme and dark theme. In these cases, no single bat theme works well. In addition, some people really want colored output to be congruous with the rest of their terminal programs, and don't care so much about it using a wide range of colors. In both cases, a solution is to use the 8- or 16-ANSI color palette the user has already configured for their terminal. The key difference is the added level of indirection: instead of choosing colors, we choose palette numbers and the user chooses colors.
This PR adds three new themes. They are based on the base16 textmate theme, but modified to encode the 16 palette numbers as RGB colours "#000000" through "#0f0000". This is necessary because tmTheme/Syntect require concrete RGB colors. It's might seem slightly hacky, but I don't think it's worth generalizing Syntect to other notions of color just so we can pass it the number 10 instead of the string "#0a0000".
Here's how the themes should be used:
Note, I just put the new theme files in
assets/themes
for now. It works if I build the cache from that directory. The README seems to say I'm not supposed to check in the new binary files with my PR, however.Screenshots
I ran
bat --list-themes
on three color themes for macOS Terminal.app.Default light profile:
Dark profile:
Base16 Ocean profile:
In general, the base16 ones might look ok for non-base16 profiles, or it might look terrible. It depends on how the upper 8 of the 16 colors are configured. The ansi themes work on anything, but for base16 profiles the base16 theme will look better (thought it might be hard to tell in the above screenshot).