1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
// #[cfg(feature = "colors")]
// use colored::{Color, ColoredString, Colorize};
// use flexi_logger::color_from_ansi_code;
//
fn main() {
// #[cfg(not(feature = "colors"))]
// println!("Feature color is switched off");
// #[cfg(feature = "colors")]
// {
// use std::io::IsTerminal;;
// colored::control::set_override(true);
// for r in [0, 95, 135, 175, 215, 255] {
// for g in [0, 95, 135, 175, 215, 255] {
// for b in [0, 95, 135, 175, 215, 255] {
// println!(
// " rgb = ({:3}, {:3}, {:3}), {}",
// r,
// g,
// b,
// "hello".truecolor(r, g, b)
// );
// }
// }
// }
// for i in 0..=255 {
// print!("{}: {}", i, nu_ansi_term::Color::Fixed(i).paint(i.to_string()));
// println!("{}: {}", i, i.to_string().color(color_from_ansi_code(i)));
// }
// println!();
// if std::io::stdout().is_terminal() {
// println!(
// "Stdout is considered a tty - \
// flexi_logger::AdaptiveFormat will use colors",
// );
// } else {
// println!(
// "Stdout is not considered a tty - \
// flexi_logger::AdaptiveFormat will NOT use colors"
// );
// }
// if std::io::stderr().is_terminal() {
// println!(
// "Stderr is considered a tty - \
// flexi_logger::AdaptiveFormat will use colors",
// );
// } else {
// println!(
// "Stderr is not considered a tty - \
// flexi_logger::AdaptiveFormat will NOT use colors!"
// );
// }
// #[cfg(target_os = "windows")]
// if nu_ansi_term::enable_ansi_support().is_err() {
// println!("Unsupported windows console detected, coloring will likely not work");
// }
// println!(
// "\n{}",
// "err! output (red) with default palette"
// .color(color_from_ansi_code(196))
// .bold()
// );
// println!(
// "{}",
// "warn! output (yellow) with default palette"
// .color(color_from_ansi_code(208))
// .bold()
// );
// println!("info! output (normal) with default palette");
// println!(
// "{}",
// "debug! output (normal) with default palette"
// .color(color_from_ansi_code(7))
// .bold()
// );
// println!(
// "{}",
// "trace! output (grey) with default palette"
// .color(color_from_ansi_code(8))
// .bold()
// );
// println!("\n{}", "err! output (red) with env_logger-palette".red());
// println!(
// "{}",
// "warn! output (yellow) with env_logger-palette".yellow()
// );
// println!("{}", "info! output (green) with env_logger-palette".green());
// println!("{}", "debug! output (blue) with env_logger-palette".blue());
// println!("{}", "trace! output (cyan) with env_logger-palette".cyan());
// }
}
|