summaryrefslogtreecommitdiff
path: root/cli/colors.rs
diff options
context:
space:
mode:
authorValentin Anger <syrupthinker@gryphno.de>2020-07-12 14:16:33 +0200
committerGitHub <noreply@github.com>2020-07-12 14:16:33 +0200
commit3374c73fba3a96df22d0c04e6c17078ca8cce45b (patch)
tree91d996554a2e276724a86ecb3bff19ea5411238b /cli/colors.rs
parent871f9255e37b4d2e63439c84da8e9bed6b388034 (diff)
feat(doc): Improve terminal printer (#6594)
- Add more support for generics - Add the --private flag - displays documentation for not exported and private nodes - Display more attributes like abstract, static and readonly - Display type aliases - Refactor module to use the Display trait - Use a bit more color
Diffstat (limited to 'cli/colors.rs')
-rw-r--r--cli/colors.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/cli/colors.rs b/cli/colors.rs
index ccbcc926a..870f7f435 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, Magenta, Red, White};
+use termcolor::Color::{Ansi256, Black, Blue, Green, Magenta, Red, White};
use termcolor::{Ansi, ColorSpec, WriteColor};
#[cfg(windows)]
@@ -54,7 +54,10 @@ 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(Ansi256(10))).set_bold(true);
+ style_spec
+ .set_fg(Some(Green))
+ .set_bold(true)
+ .set_intense(true);
style(&s, style_spec)
}
@@ -102,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(Ansi256(10)));
+ style_spec.set_fg(Some(Green)).set_intense(true);
style(&s, style_spec)
}
@@ -124,6 +127,12 @@ pub fn gray(s: &str) -> impl fmt::Display {
style(&s, style_spec)
}
+pub fn italic_gray(s: &str) -> impl fmt::Display {
+ let mut style_spec = ColorSpec::new();
+ style_spec.set_fg(Some(Ansi256(8))).set_italic(true);
+ style(&s, style_spec)
+}
+
pub fn italic_bold_gray(s: &str) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec
@@ -132,3 +141,9 @@ pub fn italic_bold_gray(s: &str) -> impl fmt::Display {
.set_italic(true);
style(&s, style_spec)
}
+
+pub fn intense_blue(s: &str) -> impl fmt::Display {
+ let mut style_spec = ColorSpec::new();
+ style_spec.set_fg(Some(Blue)).set_intense(true);
+ style(&s, style_spec)
+}