From 0ae203a779b8a75b3b79b409d92558d4bda92133 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Tue, 25 Jun 2013 16:38:32 -0700 Subject: Refactor extra::term a bit Move all the colors into a nested mod named color instead of prefixing with "color_". Define a new type color::Color, and make this a u16 instead of a u8 (to allow for easy comparisons against num_colors, which is a u16). Remove color_supported and replace it with num_colors. Teach fg() and bg() to "dim" bright colors down to the normal intensity if num_colors isn't high enough. Remove unnecessary copies, and fix a bug where a terminfo parse failure would try to use the wrong error and end up failing. --- src/libsyntax/diagnostic.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index a904416d7a4..89867922b25 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -178,16 +178,16 @@ fn diagnosticstr(lvl: level) -> ~str { } } -fn diagnosticcolor(lvl: level) -> u8 { +fn diagnosticcolor(lvl: level) -> term::color::Color { match lvl { - fatal => term::color_bright_red, - error => term::color_bright_red, - warning => term::color_bright_yellow, - note => term::color_bright_green + fatal => term::color::bright_red, + error => term::color::bright_red, + warning => term::color::bright_yellow, + note => term::color::bright_green } } -fn print_maybe_colored(msg: &str, color: u8) { +fn print_maybe_colored(msg: &str, color: term::color::Color) { let stderr = io::stderr(); let t = term::Terminal::new(stderr); -- cgit 1.4.1-3-g733a5