[][src]Trait pastel::ansi::AnsiColor

pub trait AnsiColor {
    fn from_ansi_8bit(code: u8) -> Self;
fn to_ansi_8bit(&self) -> u8;
fn to_ansi_sequence(&self, mode: Mode) -> String; }

Required methods

fn from_ansi_8bit(code: u8) -> Self

fn to_ansi_8bit(&self) -> u8

fn to_ansi_sequence(&self, mode: Mode) -> String

Loading content...

Implementors

impl AnsiColor for Color[src]

fn from_ansi_8bit(code: u8) -> Color[src]

Create a color from an 8-bit ANSI escape code

See: https://en.wikipedia.org/wiki/ANSI_escape_code

fn to_ansi_8bit(&self) -> u8[src]

Approximate a color by its closest 8-bit ANSI color (as measured by the perceived color distance).

See: https://en.wikipedia.org/wiki/ANSI_escape_code

fn to_ansi_sequence(&self, mode: Mode) -> String[src]

Return an ANSI escape sequence in 8-bit or 24-bit representation:

  • 8-bit: ESC[38;5;CODEm, where CODE represents the color.
  • 24-bit: ESC[38;2;R;G;Bm, where R, G, B represent 8-bit RGB values
Loading content...