extern crate termit_ion as termion; use std::io::stdin; use std::io::stdout; use termion::color::{AnsiValue, Bg, DetectColors}; use termion::raw::IntoRawMode; fn main() { let count; { let mut term = stdout().into_raw_mode().unwrap(); count = term.available_colors(stdin()).unwrap(); } println!("This terminal supports {} colors.", count); for i in 0..count { print!("{} {}", Bg(AnsiValue(i as u8)), Bg(AnsiValue(0))); } println!(); }