about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2013-06-25 16:38:32 -0700
committerCorey Richardson <corey@octayn.net>2013-06-26 18:07:17 -0400
commit0ae203a779b8a75b3b79b409d92558d4bda92133 (patch)
treef496a99e24c3058116ef53f2f632360850785ac2 /src/libsyntax
parent00b4138857055ba3495a70a01eea0bc8d9fed690 (diff)
downloadrust-0ae203a779b8a75b3b79b409d92558d4bda92133.tar.gz
rust-0ae203a779b8a75b3b79b409d92558d4bda92133.zip
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.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs12
1 files changed, 6 insertions, 6 deletions
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);