summaryrefslogtreecommitdiff
path: root/cli/colors.rs
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2020-03-28 22:35:31 +0100
committerGitHub <noreply@github.com>2020-03-28 17:35:31 -0400
commitad198b1cf175a1b88a6f698510bb0122e569f3ac (patch)
tree95b0505a3cb189b9501e1c670e3d2e63245bfb28 /cli/colors.rs
parentd6cb3892d48209fdb9c5196bb444e33a82bd3724 (diff)
feat: Added colors to doc output (#4518)
Diffstat (limited to 'cli/colors.rs')
-rw-r--r--cli/colors.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/colors.rs b/cli/colors.rs
index 5afd773cd..764704a5b 100644
--- a/cli/colors.rs
+++ b/cli/colors.rs
@@ -3,7 +3,7 @@ use regex::Regex;
use std::env;
use std::fmt;
use std::io::Write;
-use termcolor::Color::{Ansi256, Black, Red, White};
+use termcolor::Color::{Ansi256, Black, Magenta, Red, White};
use termcolor::{Ansi, ColorSpec, WriteColor};
#[cfg(windows)]
@@ -88,6 +88,12 @@ pub fn green(s: String) -> impl fmt::Display {
style(&s, style_spec)
}
+pub fn magenta(s: String) -> impl fmt::Display {
+ let mut style_spec = ColorSpec::new();
+ style_spec.set_fg(Some(Magenta));
+ style(&s, style_spec)
+}
+
pub fn bold(s: String) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec.set_bold(true);