diff options
Diffstat (limited to '')
-rw-r--r-- | vendor/nu-ansi-term/examples/256_colors.rs (renamed from vendor/ansi_term/examples/256_colours.rs) | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/vendor/ansi_term/examples/256_colours.rs b/vendor/nu-ansi-term/examples/256_colors.rs index 92fe2f1c1..4766dcdb6 100644 --- a/vendor/ansi_term/examples/256_colours.rs +++ b/vendor/nu-ansi-term/examples/256_colors.rs @@ -1,27 +1,26 @@ -extern crate ansi_term; -use ansi_term::Colour; +extern crate nu_ansi_term; +use nu_ansi_term::Color; -// This example prints out the 256 colours. +// This example prints out the 256 colors. // They're arranged like this: // -// - 0 to 8 are the eight standard colours. -// - 9 to 15 are the eight bold colours. -// - 16 to 231 are six blocks of six-by-six colour squares. +// - 0 to 8 are the eight standard colors. +// - 9 to 15 are the eight bold colors. +// - 16 to 231 are six blocks of six-by-six color squares. // - 232 to 255 are shades of grey. fn main() { - // First two lines for c in 0..8 { glow(c, c != 0); print!(" "); } - print!("\n"); + println!(); for c in 8..16 { glow(c, c != 8); print!(" "); } - print!("\n\n"); + println!("\n"); // Six lines of the first three squares for row in 0..6 { @@ -34,9 +33,9 @@ fn main() { print!(" "); } - print!("\n"); + println!(); } - print!("\n"); + println!(); // Six more lines of the other three squares for row in 0..6 { @@ -49,25 +48,25 @@ fn main() { print!(" "); } - print!("\n"); + println!(); } - print!("\n"); + println!(); // The last greyscale lines for c in 232..=243 { glow(c, false); print!(" "); } - print!("\n"); + println!(); for c in 244..=255 { glow(c, true); print!(" "); } - print!("\n"); + println!(); } fn glow(c: u8, light_bg: bool) { - let base = if light_bg { Colour::Black } else { Colour::White }; - let style = base.on(Colour::Fixed(c)); + let base = if light_bg { Color::Black } else { Color::White }; + let style = base.on(Color::Fixed(c)); print!("{}", style.paint(&format!(" {:3} ", c))); } |