From 3374c73fba3a96df22d0c04e6c17078ca8cce45b Mon Sep 17 00:00:00 2001 From: Valentin Anger Date: Sun, 12 Jul 2020 14:16:33 +0200 Subject: 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 --- cli/colors.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'cli/colors.rs') 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) +} -- cgit v1.2.3