mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-22 12:58:26 +00:00
Expose theme env vars
This commit is contained in:
parent
e075fee5bf
commit
60e4027332
@ -140,9 +140,9 @@ fn get_args_from_str(content: &str) -> Result<Vec<OsString>, shell_words::ParseE
|
|||||||
pub fn get_args_from_env_vars() -> Vec<OsString> {
|
pub fn get_args_from_env_vars() -> Vec<OsString> {
|
||||||
[
|
[
|
||||||
("--tabs", "BAT_TABS"),
|
("--tabs", "BAT_TABS"),
|
||||||
("--theme", "BAT_THEME"),
|
("--theme", bat::theme::env::BAT_THEME),
|
||||||
("--theme-dark", "BAT_THEME_DARK"),
|
("--theme-dark", bat::theme::env::BAT_THEME_DARK),
|
||||||
("--theme-light", "BAT_THEME_LIGHT"),
|
("--theme-light", bat::theme::env::BAT_THEME_LIGHT),
|
||||||
("--pager", "BAT_PAGER"),
|
("--pager", "BAT_PAGER"),
|
||||||
("--paging", "BAT_PAGING"),
|
("--paging", "BAT_PAGING"),
|
||||||
("--style", "BAT_STYLE"),
|
("--style", "BAT_STYLE"),
|
||||||
|
10
src/theme.rs
10
src/theme.rs
@ -5,6 +5,16 @@ use std::fmt;
|
|||||||
use std::io::IsTerminal as _;
|
use std::io::IsTerminal as _;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
/// Environment variable names.
|
||||||
|
pub mod env {
|
||||||
|
/// See [`crate::theme::ThemeOptions::theme`].
|
||||||
|
pub const BAT_THEME: &str = "BAT_THEME";
|
||||||
|
/// See [`crate::theme::ThemeOptions::theme_dark`].
|
||||||
|
pub const BAT_THEME_DARK: &str = "BAT_THEME";
|
||||||
|
/// See [`crate::theme::ThemeOptions::theme_light`].
|
||||||
|
pub const BAT_THEME_LIGHT: &str = "BAT_THEME";
|
||||||
|
}
|
||||||
|
|
||||||
/// Chooses an appropriate theme or falls back to a default theme
|
/// Chooses an appropriate theme or falls back to a default theme
|
||||||
/// based on the user-provided options and the color scheme of the terminal.
|
/// based on the user-provided options and the color scheme of the terminal.
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user