pub fn apply<T: Terminal + ?Sized>(self, term: &mut T) -> term::Result<()> {
        term.reset()?;

        macro_rules! fg_color {
            ($color:expr, $term_color:ident) => {
                if self.contains($color) {
                    if term.supports_color() {
                        term.fg(term::color::$term_color)?;
                    }
                }
            };
        }

        fg_color!(FG_BLACK, BLACK);
        fg_color!(FG_BLUE, BLUE);
        fg_color!(FG_BRIGHT_BLACK, BRIGHT_BLACK);
        fg_color!(FG_BRIGHT_BLUE, BRIGHT_BLUE);
        fg_color!(FG_BRIGHT_CYAN, BRIGHT_CYAN);
        fg_color!(FG_BRIGHT_GREEN, BRIGHT_GREEN);
        fg_color!(FG_BRIGHT_MAGENTA, BRIGHT_MAGENTA);
        fg_color!(FG_BRIGHT_RED, BRIGHT_RED);
        fg_color!(FG_BRIGHT_WHITE, BRIGHT_WHITE);
        fg_color!(FG_BRIGHT_YELLOW, BRIGHT_YELLOW);
        fg_color!(FG_CYAN, CYAN);
        fg_color!(FG_GREEN, GREEN);
        fg_color!(FG_MAGENTA, MAGENTA);
        fg_color!(FG_RED, RED);
        fg_color!(FG_WHITE, WHITE);
        fg_color!(FG_YELLOW, YELLOW);

        macro_rules! bg_color {
            ($color:expr, $term_color:ident) => {
                if self.contains($color) {
                    if term.supports_color() {
                        term.bg(term::color::$term_color)?;
                    }
                }
            };
        }

        bg_color!(BG_BLACK, BLACK);
        bg_color!(BG_BLUE, BLUE);
        bg_color!(BG_BRIGHT_BLACK, BRIGHT_BLACK);
        bg_color!(BG_BRIGHT_BLUE, BRIGHT_BLUE);
        bg_color!(BG_BRIGHT_CYAN, BRIGHT_CYAN);
        bg_color!(BG_BRIGHT_GREEN, BRIGHT_GREEN);
        bg_color!(BG_BRIGHT_MAGENTA, BRIGHT_MAGENTA);
        bg_color!(BG_BRIGHT_RED, BRIGHT_RED);
        bg_color!(BG_BRIGHT_WHITE, BRIGHT_WHITE);
        bg_color!(BG_BRIGHT_YELLOW, BRIGHT_YELLOW);
        bg_color!(BG_CYAN, CYAN);
        bg_color!(BG_GREEN, GREEN);
        bg_color!(BG_MAGENTA, MAGENTA);
        bg_color!(BG_RED, RED);
        bg_color!(BG_WHITE, WHITE);
        bg_color!(BG_YELLOW, YELLOW);

        macro_rules! attr {
            ($attr:expr, $term_attr:expr) => {
                if self.contains($attr) {
                    let attr = $term_attr;
                    if term.supports_attr(attr) {
                        term.attr(attr)?;
                    }
                }
            };
        }

        attr!(BOLD, term::Attr::Bold);
        attr!(DIM, term::Attr::Dim);
        attr!(ITALIC, term::Attr::Italic(true));
        attr!(UNDERLINE, term::Attr::Underline(true));
        attr!(BLINK, term::Attr::Blink);
        attr!(STANDOUT, term::Attr::Standout(true));
        attr!(REVERSE, term::Attr::Reverse);
        attr!(SECURE, term::Attr::Secure);

        Ok(())
    }
/// Attempts to apply the given style to the given terminal. If
/// the style is not supported, either there is no effect or else
/// a similar, substitute style may be applied.
Attempts to apply the given style to the given terminal. If
the style is not supported, either there is no effect or else
a similar, substitute style may be applied.
Attempts to apply the given style to the given terminal . If the style is not supported either there is no effect or else a similar substitute style may be applied .
pub fn apply<T: Terminal + ?Sized>(self, term: &mut T) -> term::Result<()> {
        term.reset()?;
        macro_rules! fg_color {
            ($color:expr, $term_color:ident) => {
                if self.contains($color) {
                    if term.supports_color() {
                        term.fg(term::color::$term_color)?;
                    }
                }
            };
        }
        fg_color!(FG_BLACK, BLACK);
        fg_color!(FG_BLUE, BLUE);
        fg_color!(FG_BRIGHT_BLACK, BRIGHT_BLACK);
        fg_color!(FG_BRIGHT_BLUE, BRIGHT_BLUE);
        fg_color!(FG_BRIGHT_CYAN, BRIGHT_CYAN);
        fg_color!(FG_BRIGHT_GREEN, BRIGHT_GREEN);
        fg_color!(FG_BRIGHT_MAGENTA, BRIGHT_MAGENTA);
        fg_color!(FG_BRIGHT_RED, BRIGHT_RED);
        fg_color!(FG_BRIGHT_WHITE, BRIGHT_WHITE);
        fg_color!(FG_BRIGHT_YELLOW, BRIGHT_YELLOW);
        fg_color!(FG_CYAN, CYAN);
        fg_color!(FG_GREEN, GREEN);
        fg_color!(FG_MAGENTA, MAGENTA);
        fg_color!(FG_RED, RED);
        fg_color!(FG_WHITE, WHITE);
        fg_color!(FG_YELLOW, YELLOW);
        macro_rules! bg_color {
            ($color:expr, $term_color:ident) => {
                if self.contains($color) {
                    if term.supports_color() {
                        term.bg(term::color::$term_color)?;
                    }
                }
            };
        }
        bg_color!(BG_BLACK, BLACK);
        bg_color!(BG_BLUE, BLUE);
        bg_color!(BG_BRIGHT_BLACK, BRIGHT_BLACK);
        bg_color!(BG_BRIGHT_BLUE, BRIGHT_BLUE);
        bg_color!(BG_BRIGHT_CYAN, BRIGHT_CYAN);
        bg_color!(BG_BRIGHT_GREEN, BRIGHT_GREEN);
        bg_color!(BG_BRIGHT_MAGENTA, BRIGHT_MAGENTA);
        bg_color!(BG_BRIGHT_RED, BRIGHT_RED);
        bg_color!(BG_BRIGHT_WHITE, BRIGHT_WHITE);
        bg_color!(BG_BRIGHT_YELLOW, BRIGHT_YELLOW);
        bg_color!(BG_CYAN, CYAN);
        bg_color!(BG_GREEN, GREEN);
        bg_color!(BG_MAGENTA, MAGENTA);
        bg_color!(BG_RED, RED);
        bg_color!(BG_WHITE, WHITE);
        bg_color!(BG_YELLOW, YELLOW);
        macro_rules! attr {
            ($attr:expr, $term_attr:expr) => {
                if self.contains($attr) {
                    let attr = $term_attr;
                    if term.supports_attr(attr) {
                        term.attr(attr)?;
                    }
                }
            };
        }
        attr!(BOLD, term::Attr::Bold);
        attr!(DIM, term::Attr::Dim);
        attr!(ITALIC, term::Attr::Italic(true));
        attr!(UNDERLINE, term::Attr::Underline(true));
        attr!(BLINK, term::Attr::Blink);
        attr!(STANDOUT, term::Attr::Standout(true));
        attr!(REVERSE, term::Attr::Reverse);
        attr!(SECURE, term::Attr::Secure);
        Ok(())
    }
pub fn apply < T : Terminal + ? Sized > ( self , term : & mut T ) -> term :: Result < ( ) > { term . reset ( ) ? ; macro_rules! fg_color { ( $color : expr $term_color : ident ) => { if self contains ( $color ) { if term supports_color ( ) { term fg ( term color $term_color ) } } } ; } fg_color ! ( FG_BLACK BLACK ) ; fg_color ! ( FG_BLUE BLUE ) ; fg_color ! ( FG_BRIGHT_BLACK BRIGHT_BLACK ) ; fg_color ! ( FG_BRIGHT_BLUE BRIGHT_BLUE ) ; fg_color ! ( FG_BRIGHT_CYAN BRIGHT_CYAN ) ; fg_color ! ( FG_BRIGHT_GREEN BRIGHT_GREEN ) ; fg_color ! ( FG_BRIGHT_MAGENTA BRIGHT_MAGENTA ) ; fg_color ! ( FG_BRIGHT_RED BRIGHT_RED ) ; fg_color ! ( FG_BRIGHT_WHITE BRIGHT_WHITE ) ; fg_color ! ( FG_BRIGHT_YELLOW BRIGHT_YELLOW ) ; fg_color ! ( FG_CYAN CYAN ) ; fg_color ! ( FG_GREEN GREEN ) ; fg_color ! ( FG_MAGENTA MAGENTA ) ; fg_color ! ( FG_RED RED ) ; fg_color ! ( FG_WHITE WHITE ) ; fg_color ! ( FG_YELLOW YELLOW ) ; macro_rules! bg_color { ( $color : expr $term_color : ident ) => { if self contains ( $color ) { if term supports_color ( ) { term bg ( term color $term_color ) } } } ; } bg_color ! ( BG_BLACK BLACK ) ; bg_color ! ( BG_BLUE BLUE ) ; bg_color ! ( BG_BRIGHT_BLACK BRIGHT_BLACK ) ; bg_color ! ( BG_BRIGHT_BLUE BRIGHT_BLUE ) ; bg_color ! ( BG_BRIGHT_CYAN BRIGHT_CYAN ) ; bg_color ! ( BG_BRIGHT_GREEN BRIGHT_GREEN ) ; bg_color ! ( BG_BRIGHT_MAGENTA BRIGHT_MAGENTA ) ; bg_color ! ( BG_BRIGHT_RED BRIGHT_RED ) ; bg_color ! ( BG_BRIGHT_WHITE BRIGHT_WHITE ) ; bg_color ! ( BG_BRIGHT_YELLOW BRIGHT_YELLOW ) ; bg_color ! ( BG_CYAN CYAN ) ; bg_color ! ( BG_GREEN GREEN ) ; bg_color ! ( BG_MAGENTA MAGENTA ) ; bg_color ! ( BG_RED RED ) ; bg_color ! ( BG_WHITE WHITE ) ; bg_color ! ( BG_YELLOW YELLOW ) ; macro_rules! attr { ( $attr : expr $term_attr : expr ) => { if self contains ( $attr ) { let attr $term_attr if term supports_attr ( attr ) { term attr ( attr ) } } } ; } attr ! ( BOLD term Attr Bold ) ; attr ! ( DIM term Attr Dim ) ; attr ! ( ITALIC term Attr Italic ( true ) ) ; attr ! ( UNDERLINE term Attr Underline ( true ) ) ; attr ! ( BLINK term Attr Blink ) ; attr ! ( STANDOUT term Attr Standout ( true ) ) ; attr ! ( REVERSE term Attr Reverse ) ; attr ! ( SECURE term Attr Secure ) ; Ok ( ( ) ) }
Attempts to apply the given style to the given terminal.
Attempts to apply the given style to the given terminal .
self
term
&mut T
self
term
&mut T