@ -238,8 +238,8 @@ json: Output the results as a machine-readable JSON array with an element per fi
Arg ::new ( " background " ) . long ( " background " )
. value_name ( " BACKGROUND " )
. env ( " DFT_BACKGROUND " )
. value_parser ( [ " dark " , " light " , " auto " ])
. default_value ( " auto " )
. value_parser ( [ " dark " , " light " ])
. default_value ( " dark " )
. action ( ArgAction ::Set )
. help ( " Set the background brightness. Difftastic will prefer brighter colours on dark backgrounds. " )
)
@ -819,7 +819,6 @@ pub(crate) fn parse_args() -> Mode {
{
" dark " = > BackgroundColor ::Dark ,
" light " = > BackgroundColor ::Light ,
" auto " = > detect_background_color ( ) . unwrap_or ( BackgroundColor ::Dark ) ,
_ = > unreachable! ( " clap has already validated the values " ) ,
} ;
@ -997,15 +996,6 @@ pub(crate) fn parse_args() -> Mode {
}
}
/// Try to detect the terminal background color.
fn detect_background_color ( ) -> Option < BackgroundColor > {
match terminal_colorsaurus ::theme_mode ( terminal_colorsaurus ::QueryOptions ::default ( ) ) {
Ok ( terminal_colorsaurus ::ThemeMode ::Dark ) = > Some ( BackgroundColor ::Dark ) ,
Ok ( terminal_colorsaurus ::ThemeMode ::Light ) = > Some ( BackgroundColor ::Light ) ,
Err ( _ ) = > None ,
}
}
/// Try to work out the width of the terminal we're on, or fall back
/// to a sensible default value.
fn detect_terminal_width ( ) -> usize {