[][src]Crate termcolor2rgb

A library for converting termcolor::Color to RGB

use termcolor;

// Declare extending termcolor::Color by using a trait.
// .to_rgb() method is made available.
use termcolor2rgb::ColorExt;

// Basic 8 colors
assert_eq!(termcolor::Color::Red.to_rgb(), (0x80, 0, 0));

// ANSI 256 colors
assert_eq!(termcolor::Color::Ansi256(223).to_rgb(), (0xff, 0xd7, 0xaf));

// RGB color
assert_eq!(termcolor::Color::Rgb(0x12, 0x89, 0xef).to_rgb(), (0x12, 0x89, 0xef));

termcolor: https://crates.io/crates/termcolor



Trait to extend termcolor::Color.