1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-11 15:52:25 +01:00

Add ansi theme to replace ansi-light and ansi-dark

This combines ansi-light and ansi-dark into a single theme that works
with both light and dark backgrounds. Instead of specifying white/black,
the ansi theme uses the terminal's default foreground/background color
by setting alpha=01, i.e. #00000001. This is in addition to the alpha=00
encoding where red contains an ANSI color palette number.

Now, `--theme ansi-light` and `--theme ansi-dark` will print a
deprecation notice and use ansi instead (unless the user has a custom
theme named ansi-light or ansi-dark, which would take precedence).
This commit is contained in:
Mitchell Kember
2020-11-29 17:16:54 -05:00
committed by David Peter
parent 19e7763f35
commit 3099f51ba7
7 changed files with 62 additions and 614 deletions

View File

@@ -189,6 +189,15 @@ impl HighlightingAssets {
match self.theme_set.themes.get(theme) {
Some(theme) => theme,
None => {
if theme == "ansi-light" || theme == "ansi-dark" {
use ansi_term::Colour::Yellow;
eprintln!(
"{}: Theme '{}' is deprecated, using 'ansi' instead.",
Yellow.paint("[bat warning]"),
theme
);
return self.get_theme("ansi");
}
if theme != "" {
use ansi_term::Colour::Yellow;
eprintln!(