mirror of
https://github.com/sharkdp/bat.git
synced 2025-03-20 17:48:33 +00:00
display which theme is the default one in colored output
This commit is contained in:
parent
01731478a6
commit
1c9e7e3e4a
@ -30,6 +30,7 @@ use directories::PROJECT_DIRS;
|
|||||||
use globset::GlobMatcher;
|
use globset::GlobMatcher;
|
||||||
|
|
||||||
use bat::{
|
use bat::{
|
||||||
|
assets::HighlightingAssets,
|
||||||
config::Config,
|
config::Config,
|
||||||
controller::Controller,
|
controller::Controller,
|
||||||
error::*,
|
error::*,
|
||||||
@ -200,11 +201,18 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result<
|
|||||||
let mut stdout = stdout.lock();
|
let mut stdout = stdout.lock();
|
||||||
|
|
||||||
if config.colored_output {
|
if config.colored_output {
|
||||||
|
let default_theme = HighlightingAssets::default_theme();
|
||||||
for theme in assets.themes() {
|
for theme in assets.themes() {
|
||||||
|
let default_theme_info = if default_theme == theme {
|
||||||
|
" (default)"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
writeln!(
|
writeln!(
|
||||||
stdout,
|
stdout,
|
||||||
"Theme: {}\n",
|
"Theme: {}{}\n",
|
||||||
Style::new().bold().paint(theme.to_string())
|
Style::new().bold().paint(theme.to_string()),
|
||||||
|
default_theme_info
|
||||||
)?;
|
)?;
|
||||||
config.theme = theme.to_string();
|
config.theme = theme.to_string();
|
||||||
Controller::new(&config, &assets)
|
Controller::new(&config, &assets)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user