-
-
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 new theme: base16-256 #1111
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b6500f0
to
62cf203
Compare
@sharkdp Please take a look when you have time :) I've also updated the README with a section on the 8-bit color themes (ansi-dark, ansi-light, base16, and base16-256) to help avoid confusion about them. |
Thank you very much for your contribution and for the awesome documentation (and updating the README)! I have only one minor request: Could you please add an entry to the "unreleased" section in the
where |
I rebased your branch on master in order to run the new CI pipelines. I am expecting one (new) test to fail, which regenerates the binary caches before running the unit tests. We simply have to add the theme to
yes 👍 |
Bat already has a base16 theme. The new base16-256 theme is for users of base16-shell, who configure their terminal with a 256-color variant of a base16 theme. These variants put some of the base16 colors in elsewhere in the 256-color table to avoid clobbering bright color slots (ansi codes 8 to 15) with colors that don't respect the ordinary meaning of that slot (e.g. bright green in ordinary base16 is not green). For more details, see https://github.com/chriskempson/base16-shell
Done! (I amended the 1st commit and force pushed) |
Thank you for the update. My new testing mechanism catches the (future) error, but now the tests for the old binary theme set fail, of course. I'm adding the updated |
Added in v0.16.0. |
See #1033 for the discussion that led to this.
In summary, the base16 theme introduced in #543 works great for users who configure their terminals with the base16 system in which the 16 ANSI colors are repurposed as base16 palette slots. But it doesn't work for users of base16-shell, which aims to solve problems with base16-unaware software by leaving the bright colors (ANSI 8-15) alone, and instead using codes 16-21 for extra base16 palette slots (requiring a 256-color terminal, hence base16-256).
Here is how terminal themes for regular base16 and 256-color/base16-shell differ:
Notice codes 08 (bright black) and 15 (bright white) stay the same. But 09 (bright red) through 14 (bright cyan) are replaced with their non-bright counterparts, and those base16 colors are moved to ANSI codes 16-21.
So the new base16-256 theme is just like base16, but makes the following replacements:
#09000000
→#10000000
#0a000000
→#12000000
#0b000000
→#13000000
#0c000000
→#14000000
#0d000000
→#15000000
#0e000000
→#11000000
terminal.rs already maps any
#RR000000
to the 256-color codeRR
, so no code change is needed.Here is what base16 and base16-256 look like on macOS, kitty terminal with https://github.com/kdrag0n/base16-kitty/blob/master/colors/base16-solarized-light-256.conf, and fish shell with base16-shell/profile_helper.fish sourced:
It's not so obvious in this example, but in this theme constants like
2.0
are supposed to be orange, not red. The base16 theme shows red because it's using ANSI bright red (which is just plain red in the 256-color terminal theme). The base16-256 theme correctly shows it as orange because it instead uses ANSI code 16.Note: I have not regenerated themes.bin — I assume that will be done on release as before.