Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use only colors supported by conhost.exe #661

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/benchmark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl<'a> Benchmark<'a> {

let msg = {
let mean = format_duration(mean(&times_real), self.options.time_unit);
format!("Current estimate: {}", mean.to_string().green())
format!("Current estimate: {}", mean.to_string().yellow().bold())
};

if let Some(bar) = progress_bar.as_ref() {
Expand Down Expand Up @@ -285,31 +285,31 @@ impl<'a> Benchmark<'a> {
if times_real.len() == 1 {
println!(
" Time ({} ≡): {:>8} {:>8} [User: {}, System: {}]",
"abs".green().bold(),
mean_str.green().bold(),
"abs".yellow().bold(),
mean_str.yellow().bold(),
" ", // alignment
user_str.blue(),
system_str.blue()
user_str.cyan(),
system_str.cyan()
);
} else {
let stddev_str = format_duration(t_stddev.unwrap(), Some(time_unit));

println!(
" Time ({} ± {}): {:>8} ± {:>8} [User: {}, System: {}]",
"mean".green().bold(),
"σ".green(),
mean_str.green().bold(),
stddev_str.green(),
user_str.blue(),
system_str.blue()
"mean".yellow().bold(),
"σ",
mean_str.yellow().bold(),
stddev_str,
user_str.cyan(),
system_str.cyan()
);

println!(
" Range ({} … {}): {:>8} … {:>8} {}",
"min".cyan(),
"max".purple(),
min_str.cyan(),
max_str.purple(),
"min".bright_green(),
"max".bright_red(),
min_str.bright_green(),
max_str.bright_red(),
num_str.dimmed()
);
}
Expand Down Expand Up @@ -357,7 +357,7 @@ impl<'a> Benchmark<'a> {
eprintln!(" ");

for warning in &warnings {
eprintln!(" {}: {}", "Warning".yellow(), warning);
eprintln!(" {}: {}", "Warning".yellow().bold(), warning);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/benchmark/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ impl<'a> Scheduler<'a> {
for item in others {
println!(
"{}{} times faster than {}",
format!("{:8.2}", item.relative_speed).bold().green(),
format!("{:8.2}", item.relative_speed).yellow().bold(),
if let Some(stddev) = item.relative_speed_stddev {
format!(" ± {}", format!("{:.2}", stddev).green())
format!(" ± {}", format!("{:.2}", stddev).yellow().bold())
} else {
"".into()
},
&item.result.command_with_unused_parameters.magenta()
&item.result.command_with_unused_parameters.cyan()
);
}
}
Expand All @@ -100,11 +100,11 @@ impl<'a> Scheduler<'a> {
for item in annotated_results {
println!(
" {}{} {}",
format!("{:10.2}", item.relative_speed).bold().green(),
format!("{:10.2}", item.relative_speed).yellow().bold(),
if item.is_fastest {
" ".into()
} else if let Some(stddev) = item.relative_speed_stddev {
format!(" ± {}", format!("{:5.2}", stddev).green())
format!(" ± {}", format!("{:5.2}", stddev).yellow().bold())
} else {
" ".into()
},
Expand All @@ -121,7 +121,7 @@ impl<'a> Scheduler<'a> {
Try to re-run the benchmark on a quiet system. If you did not do so already, try the \
--shell=none/-N option. If it does not help either, you command is most likely too fast \
to be accurately benchmarked by hyperfine.",
"Note".bold().red()
"Note".bright_red()
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn main() {
match run() {
Ok(_) => {}
Err(e) => {
eprintln!("{} {:#}", "Error:".red(), e);
eprintln!("{} {:#}", "Error:".bright_red(), e);
std::process::exit(1);
}
}
Expand Down