0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

fix(cli): colors mismatch (#7367)

This commit is contained in:
EathonYe 2020-09-08 18:04:02 +08:00 committed by GitHub
parent ab7f93caf1
commit 05c46f5969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,9 @@ use regex::Regex;
use std::env;
use std::fmt;
use std::io::Write;
use termcolor::Color::{Ansi256, Black, Blue, Green, Magenta, Red, White};
use termcolor::Color::{
Ansi256, Black, Blue, Cyan, Green, Magenta, Red, White, Yellow,
};
use termcolor::{Ansi, ColorSpec, WriteColor};
#[cfg(windows)]
@ -55,10 +57,7 @@ pub fn red_bold(s: &str) -> impl fmt::Display {
pub fn green_bold(s: &str) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec
.set_fg(Some(Green))
.set_bold(true)
.set_intense(true);
style_spec.set_fg(Some(Green)).set_bold(true);
style(&s, style_spec)
}
@ -82,19 +81,19 @@ pub fn white_on_red(s: &str) -> impl fmt::Display {
pub fn white_on_green(s: &str) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec.set_bg(Some(Ansi256(10))).set_fg(Some(White));
style_spec.set_bg(Some(Green)).set_fg(Some(White));
style(&s, style_spec)
}
pub fn yellow(s: &str) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec.set_fg(Some(Ansi256(11)));
style_spec.set_fg(Some(Yellow));
style(&s, style_spec)
}
pub fn cyan(s: &str) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec.set_fg(Some(Ansi256(14)));
style_spec.set_fg(Some(Cyan));
style(&s, style_spec)
}
@ -106,7 +105,7 @@ pub fn red(s: &str) -> impl fmt::Display {
pub fn green(s: &str) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec.set_fg(Some(Green)).set_intense(true);
style_spec.set_fg(Some(Green));
style(&s, style_spec)
}