[][src]Struct owo_colors::Style

pub struct Style { /* fields omitted */ }

Implementations

impl Style[src]

pub fn new() -> Self[src]

pub fn style<T>(&self, target: T) -> Styled<T>[src]

pub fn fg<C: Color>(mut self: Self) -> Self[src]

Set the foreground color generically

use owo_colors::{OwoColorize, colors::*};

println!("{}", "red foreground".fg::<Red>());

pub fn bg<C: Color>(mut self: Self) -> Self[src]

Set the background color generically.

use owo_colors::{OwoColorize, colors::*};

println!("{}", "black background".bg::<Black>());

pub fn black(mut self: Self) -> Self[src]

Change the foreground color to black

pub fn on_black(mut self: Self) -> Self[src]

Change the foreground color to black

pub fn red(mut self: Self) -> Self[src]

Change the foreground color to red

pub fn on_red(mut self: Self) -> Self[src]

Change the foreground color to red

pub fn green(mut self: Self) -> Self[src]

Change the foreground color to green

pub fn on_green(mut self: Self) -> Self[src]

Change the foreground color to green

pub fn yellow(mut self: Self) -> Self[src]

Change the foreground color to yellow

pub fn on_yellow(mut self: Self) -> Self[src]

Change the foreground color to yellow

pub fn blue(mut self: Self) -> Self[src]

Change the foreground color to blue

pub fn on_blue(mut self: Self) -> Self[src]

Change the foreground color to blue

pub fn magenta(mut self: Self) -> Self[src]

Change the foreground color to magenta

pub fn on_magenta(mut self: Self) -> Self[src]

Change the foreground color to magenta

pub fn purple(mut self: Self) -> Self[src]

Change the foreground color to purple

pub fn on_purple(mut self: Self) -> Self[src]

Change the foreground color to purple

pub fn cyan(mut self: Self) -> Self[src]

Change the foreground color to cyan

pub fn on_cyan(mut self: Self) -> Self[src]

Change the foreground color to cyan

pub fn white(mut self: Self) -> Self[src]

Change the foreground color to white

pub fn on_white(mut self: Self) -> Self[src]

Change the foreground color to white

pub fn bright_black(mut self: Self) -> Self[src]

Change the foreground color to bright black

pub fn on_bright_black(mut self: Self) -> Self[src]

Change the foreground color to bright black

pub fn bright_red(mut self: Self) -> Self[src]

Change the foreground color to bright red

pub fn on_bright_red(mut self: Self) -> Self[src]

Change the foreground color to bright red

pub fn bright_green(mut self: Self) -> Self[src]

Change the foreground color to bright green

pub fn on_bright_green(mut self: Self) -> Self[src]

Change the foreground color to bright green

pub fn bright_yellow(mut self: Self) -> Self[src]

Change the foreground color to bright yellow

pub fn on_bright_yellow(mut self: Self) -> Self[src]

Change the foreground color to bright yellow

pub fn bright_blue(mut self: Self) -> Self[src]

Change the foreground color to bright blue

pub fn on_bright_blue(mut self: Self) -> Self[src]

Change the foreground color to bright blue

pub fn bright_magenta(mut self: Self) -> Self[src]

Change the foreground color to bright magenta

pub fn on_bright_magenta(mut self: Self) -> Self[src]

Change the foreground color to bright magenta

pub fn bright_purple(mut self: Self) -> Self[src]

Change the foreground color to bright purple

pub fn on_bright_purple(mut self: Self) -> Self[src]

Change the foreground color to bright purple

pub fn bright_cyan(mut self: Self) -> Self[src]

Change the foreground color to bright cyan

pub fn on_bright_cyan(mut self: Self) -> Self[src]

Change the foreground color to bright cyan

pub fn bright_white(mut self: Self) -> Self[src]

Change the foreground color to bright white

pub fn on_bright_white(mut self: Self) -> Self[src]

Change the foreground color to bright white

pub fn bold(mut self: Self) -> Self[src]

Make the text bold

pub fn dimmed(mut self: Self) -> Self[src]

Make the text dim

pub fn italic(mut self: Self) -> Self[src]

Make the text italicized

pub fn underline(mut self: Self) -> Self[src]

Make the text italicized

Make the text blink

Make the text blink (but fast!)

pub fn reversed(mut self: Self) -> Self[src]

Swap the foreground and background colors

pub fn hidden(mut self: Self) -> Self[src]

Hide the text

pub fn strikethrough(mut self: Self) -> Self[src]

Cross out the text

pub fn effect(mut self: Self, effect: Effect) -> Self[src]

pub fn remove_effect(mut self: Self, effect: Effect) -> Self[src]

pub fn effects(mut self: Self, effects: &[Effect]) -> Self[src]

pub fn remove_effects(mut self: Self, effects: &[Effect]) -> Self[src]

pub fn remove_all_effects(mut self: Self) -> Self[src]

pub fn color<Color: DynColor>(mut self: Self, color: Color) -> Self[src]

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green,

use owo_colors::{OwoColorize, AnsiColors};

fn main() {
    println!("{}", "green".color(AnsiColors::Green));
}

pub fn on_color<Color: DynColor>(mut self: Self, color: Color) -> Self[src]

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow,

use owo_colors::{OwoColorize, AnsiColors};

fn main() {
    println!("{}", "yellow background".on_color(AnsiColors::BrightYellow));
}

pub fn fg_rgb<const R: u8, const G: u8, const B: u8>(mut self: Self) -> Self[src]

Set the foreground color to a specific RGB value.

Requires: nightly and the custom feature.

If nightly is not preferable for you, use OwoColorize::truecolor

pub fn bg_rgb<const R: u8, const G: u8, const B: u8>(mut self: Self) -> Self[src]

Set the background color to a specific RGB value.

Requires: nightly and the custom feature.

If nightly is not preferable for you, use OwoColorize::on_truecolor

pub fn truecolor(mut self: Self, r: u8, g: u8, b: u8) -> Self[src]

Sets the foreground color to an RGB value.

pub fn on_truecolor(mut self: Self, r: u8, g: u8, b: u8) -> Self[src]

Sets the background color to an RGB value.

Trait Implementations

impl Clone for Style[src]

impl Copy for Style[src]

impl Debug for Style[src]

impl Default for Style[src]

Auto Trait Implementations

impl Send for Style[src]

impl Sync for Style[src]

impl Unpin for Style[src]

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<D> OwoColorize for D[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.