diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-06-25 16:38:32 -0700 |
|---|---|---|
| committer | Corey Richardson <corey@octayn.net> | 2013-06-26 18:07:17 -0400 |
| commit | 0ae203a779b8a75b3b79b409d92558d4bda92133 (patch) | |
| tree | f496a99e24c3058116ef53f2f632360850785ac2 /src/librustpkg | |
| parent | 00b4138857055ba3495a70a01eea0bc8d9fed690 (diff) | |
| download | rust-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/librustpkg')
| -rw-r--r-- | src/librustpkg/messages.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustpkg/messages.rs b/src/librustpkg/messages.rs index d3962470e7c..bde7aaeab8e 100644 --- a/src/librustpkg/messages.rs +++ b/src/librustpkg/messages.rs @@ -13,18 +13,18 @@ use core::io; use core::result::*; pub fn note(msg: &str) { - pretty_message(msg, "note: ", term::color_green, io::stdout()) + pretty_message(msg, "note: ", term::color::green, io::stdout()) } pub fn warn(msg: &str) { - pretty_message(msg, "warning: ", term::color_yellow, io::stdout()) + pretty_message(msg, "warning: ", term::color::yellow, io::stdout()) } pub fn error(msg: &str) { - pretty_message(msg, "error: ", term::color_red, io::stdout()) + pretty_message(msg, "error: ", term::color::red, io::stdout()) } -fn pretty_message<'a>(msg: &'a str, prefix: &'a str, color: u8, out: @io::Writer) { +fn pretty_message<'a>(msg: &'a str, prefix: &'a str, color: term::color::Color, out: @io::Writer) { let term = term::Terminal::new(out); match term { Ok(ref t) => { |
