diff options
Diffstat (limited to 'cli/ansi.rs')
-rw-r--r-- | cli/ansi.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/ansi.rs b/cli/ansi.rs index 95b5e0694..b9e9fe123 100644 --- a/cli/ansi.rs +++ b/cli/ansi.rs @@ -1,6 +1,8 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +use ansi_term::Color::Black; use ansi_term::Color::Fixed; use ansi_term::Color::Red; +use ansi_term::Color::White; use ansi_term::Style; use regex::Regex; use std::env; @@ -43,6 +45,14 @@ pub fn italic_bold(s: String) -> impl fmt::Display { style.paint(s) } +pub fn black_on_white(s: String) -> impl fmt::Display { + let mut style = Style::new(); + if use_color() { + style = style.on(White).fg(Black); + } + style.paint(s) +} + pub fn yellow(s: String) -> impl fmt::Display { let mut style = Style::new(); if use_color() { @@ -61,6 +71,22 @@ pub fn cyan(s: String) -> impl fmt::Display { style.paint(s) } +pub fn red(s: String) -> impl fmt::Display { + let mut style = Style::new(); + if use_color() { + style = style.fg(Red); + } + style.paint(s) +} + +pub fn grey(s: String) -> impl fmt::Display { + let mut style = Style::new(); + if use_color() { + style = style.fg(Fixed(8)); + } + style.paint(s) +} + pub fn bold(s: String) -> impl fmt::Display { let mut style = Style::new(); if use_color() { |