[][src]Struct terminal_color_builder::OutputFormatter

pub struct OutputFormatter { /* fields omitted */ }

Implementations

impl OutputFormatter[src]

This struct is used to create the builder for CLI-colors the following example creates a string "hi", that has white (as hex-color) foreground and green background

Example

use terminal_color_builder::*;
let str = OutputFormatter::new().fg().hex("#fff").bg().green().text("Hi".to_string()).print();

pub fn new() -> Self[src]

pub fn fg(self) -> OutputColor[src]

Set the current context to foreground

pub fn bg(self) -> OutputColor[src]

Set the current context to foreground

pub fn custom(self, fg: COLORS, bg: COLORS) -> OutputFormatter[src]

apply custom color with the COLORS-enum

Example

use terminal_color_builder::*;
use terminal_color_builder::color::COLORS;
let c = OutputFormatter::new().custom(COLORS::White, COLORS::Green).text("Hi".to_string());

pub fn text(self, message: String) -> Self[src]

add text to apply color for

pub fn text_str(self, message: &str) -> Self[src]

add text as str to apply color for

pub fn print(&self) -> String[src]

render the builder into a string

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.