| 1 |
//! Delta doesn't have a formal concept of a "theme". What it has is |
| 2 |
//! |
| 3 |
//! 1. The choice of "theme". This is the language syntax highlighting theme; you have to make this |
| 4 |
//! choice when using `bat` also. |
| 5 |
//! 2. The choice of "light vs dark mode". This determines whether the background colors should be |
| 6 |
//! chosen for a light or dark terminal background. (`bat` has no equivalent.) |
| 7 |
//! |
| 8 |
//! Basically: |
| 9 |
//! 1. The theme is specified by the `--syntax-theme` option. If this isn't supplied then it is specified |
| 10 |
//! by the `BAT_THEME` environment variable. |
| 11 |
//! 2. Light vs dark mode is specified by the `--light` or `--dark` options. If these aren't |
| 12 |
//! supplied then it detected from the terminal. If this fails it is inferred from the chosen theme. |
| 13 |
//! |
| 14 |
//! In the absence of other factors, the default assumes a dark terminal background. |
| 15 |
|
| 16 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{stdoutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/stdout()., IsTerminalrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/IsTerminal#}; |
| 17 |
|
| 18 |
use batrust-analyzer cargo bat 0.26.1 crate/; |
| 19 |
use batrust-analyzer cargo bat 0.26.1 crate/::assetsrust-analyzer cargo bat 0.26.1 assets/::HighlightingAssetsrust-analyzer cargo bat 0.26.1 assets/HighlightingAssets#; |
| 20 |
|
| 21 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::clirust-analyzer cargo git-delta 0.19.2 cli/::{selfrust-analyzer cargo git-delta 0.19.2 cli/, DetectDarkLightrust-analyzer cargo git-delta 0.19.2 cli/DetectDarkLight#}; |
| 22 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::colorrust-analyzer cargo git-delta 0.19.2 color/::{ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#, ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#::*}; |
| 23 |
|
| 24 |
#[allow(non_snake_case)] |
| 25 |
pub fn set__color_mode__syntax_theme__syntax_setrust-analyzer cargo git-delta 0.19.2 options/theme/set__color_mode__syntax_theme__syntax_set().(opt: &mut clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, assets: HighlightingAssetsrust-analyzer cargo bat 0.26.1 assets/HighlightingAssets#) { |
| 26 |
let (color_mode, syntax_theme_name) = |
| 27 |
get_color_mode_and_syntax_theme_namerust-analyzer cargo git-delta 0.19.2 options/theme/get_color_mode_and_syntax_theme_name().(opt.syntax_themerust-analyzer cargo git-delta 0.19.2 cli/Opt#syntax_theme..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), get_color_moderust-analyzer cargo git-delta 0.19.2 options/theme/get_color_mode().(opt)); |
| 28 |
opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..color_moderust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#color_mode. = color_mode; |
| 29 |
|
| 30 |
opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..syntax_themerust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#syntax_theme. = if is_no_syntax_highlighting_syntax_theme_namerust-analyzer cargo git-delta 0.19.2 options/theme/is_no_syntax_highlighting_syntax_theme_name().(&syntax_theme_name) { |
| 31 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 32 |
} else { |
| 33 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(assets.get_themerust-analyzer cargo bat 0.26.1 assets/impl#[HighlightingAssets]get_theme().(&syntax_theme_name).clonerust-analyzer cargo syntect 5.3.0 highlighting/theme/impl#[Theme][Clone]clone().()) |
| 34 |
}; |
| 35 |
opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..syntax_setrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#syntax_set. = assets.get_syntax_setrust-analyzer cargo bat 0.26.1 assets/impl#[HighlightingAssets]get_syntax_set().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().clonerust-analyzer cargo syntect 5.3.0 parsing/syntax_set/impl#[SyntaxSet][Clone]clone().(); |
| 36 |
} |
| 37 |
|
| 38 |
pub fn is_light_syntax_themerust-analyzer cargo git-delta 0.19.2 options/theme/is_light_syntax_theme().(theme: &str) -> bool { |
| 39 |
LIGHT_SYNTAX_THEMESrust-analyzer cargo git-delta 0.19.2 options/theme/LIGHT_SYNTAX_THEMES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&theme) || theme.to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().().containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("light") |
| 40 |
} |
| 41 |
|
| 42 |
pub fn color_mode_from_syntax_themerust-analyzer cargo git-delta 0.19.2 options/theme/color_mode_from_syntax_theme().(theme: &str) -> ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode# { |
| 43 |
if is_light_syntax_themerust-analyzer cargo git-delta 0.19.2 options/theme/is_light_syntax_theme().(theme) { |
| 44 |
ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#::Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light# |
| 45 |
} else { |
| 46 |
ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#::Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark# |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
const LIGHT_SYNTAX_THEMESrust-analyzer cargo git-delta 0.19.2 options/theme/LIGHT_SYNTAX_THEMES.: [&str; 7] = [ |
| 51 |
"Catppuccin Latte", |
| 52 |
"GitHub", |
| 53 |
"gruvbox-light", |
| 54 |
"gruvbox-white", |
| 55 |
"Monokai Extended Light", |
| 56 |
"OneHalfLight", |
| 57 |
"Solarized (light)", |
| 58 |
]; |
| 59 |
|
| 60 |
const DEFAULT_LIGHT_SYNTAX_THEMErust-analyzer cargo git-delta 0.19.2 options/theme/DEFAULT_LIGHT_SYNTAX_THEME.: &str = "GitHub"; |
| 61 |
const DEFAULT_DARK_SYNTAX_THEMErust-analyzer cargo git-delta 0.19.2 options/theme/DEFAULT_DARK_SYNTAX_THEME.: &str = "Monokai Extended"; |
| 62 |
|
| 63 |
fn is_no_syntax_highlighting_syntax_theme_namerust-analyzer cargo git-delta 0.19.2 options/theme/is_no_syntax_highlighting_syntax_theme_name().(theme_name: &str) -> bool { |
| 64 |
theme_name.to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."none" |
| 65 |
} |
| 66 |
|
| 67 |
/// Return a (theme_name, color_mode) tuple. |
| 68 |
/// theme_name == None in return value means syntax highlighting is disabled. |
| 69 |
fn get_color_mode_and_syntax_theme_namerust-analyzer cargo git-delta 0.19.2 options/theme/get_color_mode_and_syntax_theme_name().( |
| 70 |
syntax_theme: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 71 |
mode: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#>, |
| 72 |
) -> (ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) { |
| 73 |
match (syntax_theme, mode) { |
| 74 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(theme), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => (color_mode_from_syntax_themerust-analyzer cargo git-delta 0.19.2 options/theme/color_mode_from_syntax_theme().(theme), theme.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 75 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(theme), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mode)) => (mode, theme.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 76 |
(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#)) => (Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#, DEFAULT_DARK_SYNTAX_THEMErust-analyzer cargo git-delta 0.19.2 options/theme/DEFAULT_DARK_SYNTAX_THEME..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 77 |
(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#)) => (Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#, DEFAULT_LIGHT_SYNTAX_THEMErust-analyzer cargo git-delta 0.19.2 options/theme/DEFAULT_LIGHT_SYNTAX_THEME..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
fn get_color_moderust-analyzer cargo git-delta 0.19.2 options/theme/get_color_mode().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#> { |
| 82 |
if opt.lightrust-analyzer cargo git-delta 0.19.2 cli/Opt#light. { |
| 83 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#) |
| 84 |
} else if opt.darkrust-analyzer cargo git-delta 0.19.2 cli/Opt#dark. { |
| 85 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#) |
| 86 |
} else if should_detect_color_moderust-analyzer cargo git-delta 0.19.2 options/theme/should_detect_color_mode().(opt) { |
| 87 |
detect_color_moderust-analyzer cargo git-delta 0.19.2 options/theme/detect_color_mode().() |
| 88 |
} else { |
| 89 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
/// See [`cli::Opt::detect_dark_light`] for a detailed explanation. |
| 94 |
fn should_detect_color_moderust-analyzer cargo git-delta 0.19.2 options/theme/should_detect_color_mode().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#) -> bool { |
| 95 |
match opt.detect_dark_lightrust-analyzer cargo git-delta 0.19.2 cli/Opt#detect_dark_light. { |
| 96 |
DetectDarkLightrust-analyzer cargo git-delta 0.19.2 cli/DetectDarkLight#::Autorust-analyzer cargo git-delta 0.19.2 cli/DetectDarkLight#Auto# => opt.color_onlyrust-analyzer cargo git-delta 0.19.2 cli/Opt#color_only. || stdoutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/stdout().().is_terminalrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdout][IsTerminal]is_terminal().(), |
| 97 |
DetectDarkLightrust-analyzer cargo git-delta 0.19.2 cli/DetectDarkLight#::Alwaysrust-analyzer cargo git-delta 0.19.2 cli/DetectDarkLight#Always# => true, |
| 98 |
DetectDarkLightrust-analyzer cargo git-delta 0.19.2 cli/DetectDarkLight#::Neverrust-analyzer cargo git-delta 0.19.2 cli/DetectDarkLight#Never# => false, |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
fn detect_color_moderust-analyzer cargo git-delta 0.19.2 options/theme/detect_color_mode().() -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#> { |
| 103 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 104 |
} |
| 105 |
|
| 106 |
#[cfg(test)] |
| 107 |
mod testsrust-analyzer cargo git-delta 0.19.2 options/theme/tests/ { |
| 108 |
use superrust-analyzer cargo git-delta 0.19.2 options/theme/::*; |
| 109 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::colorrust-analyzer cargo git-delta 0.19.2 color/; |
| 110 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::testsrust-analyzer cargo git-delta 0.19.2 tests/::integration_test_utilsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/; |
| 111 |
|
| 112 |
// TODO: Test influence of BAT_THEME env var. E.g. see utils::process::tests::FakeParentArgs. |
| 113 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 114 |
fn test_syntax_theme_selectionrust-analyzer cargo git-delta 0.19.2 options/theme/tests/test_syntax_theme_selection().() { |
| 115 |
for ( |
| 116 |
syntax_theme, |
| 117 |
mode, // (--light, --dark) |
| 118 |
expected_syntax_theme, |
| 119 |
expected_mode, |
| 120 |
) in vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 121 |
(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, DEFAULT_DARK_SYNTAX_THEMErust-analyzer cargo git-delta 0.19.2 options/theme/DEFAULT_DARK_SYNTAX_THEME., Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), |
| 122 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("GitHub"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "GitHub", Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), |
| 123 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Nord"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "Nord", Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), |
| 124 |
(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), DEFAULT_DARK_SYNTAX_THEMErust-analyzer cargo git-delta 0.19.2 options/theme/DEFAULT_DARK_SYNTAX_THEME., Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), |
| 125 |
(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), DEFAULT_LIGHT_SYNTAX_THEMErust-analyzer cargo git-delta 0.19.2 options/theme/DEFAULT_LIGHT_SYNTAX_THEME., Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), |
| 126 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("GitHub"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), "GitHub", Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), |
| 127 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("GitHub"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), "GitHub", Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), |
| 128 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Nord"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), "Nord", Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), |
| 129 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Nord"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), "Nord", Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), |
| 130 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("none"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "none", Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), |
| 131 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("none"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), "none", Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#), |
| 132 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("None"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), "none", Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#), |
| 133 |
] { |
| 134 |
let mut args = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 135 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(syntax_theme) = syntax_theme { |
| 136 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("--syntax-theme"); |
| 137 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(syntax_theme); |
| 138 |
} |
| 139 |
let is_true_color = true; |
| 140 |
if is_true_color { |
| 141 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("--true-color"); |
| 142 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("always"); |
| 143 |
} else { |
| 144 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("--true-color"); |
| 145 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("never"); |
| 146 |
} |
| 147 |
match mode { |
| 148 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light#) => { |
| 149 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("--light"); |
| 150 |
} |
| 151 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark#) => { |
| 152 |
args.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("--dark"); |
| 153 |
} |
| 154 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {} |
| 155 |
} |
| 156 |
let config = integration_test_utilsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/::make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&args); |
| 157 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 158 |
&config |
| 159 |
.syntax_themerust-analyzer cargo git-delta 0.19.2 config/Config#syntax_theme. |
| 160 |
.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().() |
| 161 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.namerust-analyzer cargo syntect 5.3.0 highlighting/theme/Theme#name..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()) |
| 162 |
.unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("none".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 163 |
expected_syntax_theme |
| 164 |
); |
| 165 |
if is_no_syntax_highlighting_syntax_theme_namerust-analyzer cargo git-delta 0.19.2 options/theme/is_no_syntax_highlighting_syntax_theme_name().(expected_syntax_theme) { |
| 166 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(config.syntax_themerust-analyzer cargo git-delta 0.19.2 config/Config#syntax_theme..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()) |
| 167 |
} else { |
| 168 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 169 |
config.syntax_themerust-analyzer cargo git-delta 0.19.2 config/Config#syntax_theme..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().namerust-analyzer cargo syntect 5.3.0 highlighting/theme/Theme#name..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 170 |
expected_syntax_theme |
| 171 |
); |
| 172 |
} |
| 173 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 174 |
config.minus_stylerust-analyzer cargo git-delta 0.19.2 config/Config#minus_style..ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 175 |
colorrust-analyzer cargo git-delta 0.19.2 color/::get_minus_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_minus_background_color_default().(expected_mode, is_true_color) |
| 176 |
); |
| 177 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 178 |
config.minus_emph_stylerust-analyzer cargo git-delta 0.19.2 config/Config#minus_emph_style..ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 179 |
colorrust-analyzer cargo git-delta 0.19.2 color/::get_minus_emph_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_minus_emph_background_color_default().(expected_mode, is_true_color) |
| 180 |
); |
| 181 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 182 |
config.plus_stylerust-analyzer cargo git-delta 0.19.2 config/Config#plus_style..ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 183 |
colorrust-analyzer cargo git-delta 0.19.2 color/::get_plus_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_plus_background_color_default().(expected_mode, is_true_color) |
| 184 |
); |
| 185 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 186 |
config.plus_emph_stylerust-analyzer cargo git-delta 0.19.2 config/Config#plus_emph_style..ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 187 |
colorrust-analyzer cargo git-delta 0.19.2 color/::get_plus_emph_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_plus_emph_background_color_default().(expected_mode, is_true_color) |
| 188 |
); |
| 189 |
} |
| 190 |
} |
| 191 |
} |