Skip to main content

Style

Enum Style 

Source
pub enum Style {
    Bold,
    Dim,
    Italic,
    Underline,
    Blink,
    Reverse,
    Hidden,
    Strikethrough,
    Reset,
}
Expand description

Represents ANSI text formatting styles.

Variants§

§

Bold

Makes the text bold or increased intensity.

§

Dim

Decreases the intensity of the text.

§

Italic

Makes the text italic (not supported in all terminals).

§

Underline

Underlines the text (not supported in all terminals).

Makes the text blink (not supported in all terminals).

§

Reverse

Reverses the foreground and background colors.

§

Hidden

Hides the text (not supported in all terminals).

§

Strikethrough

Puts a line through the text (not supported in all terminals).

§

Reset

Resets all styles to default.

Implementations§

Source§

impl Style

Source

pub const fn to_str(&self) -> &'static str

Returns the ANSI escape sequence for the text style.

§Examples
use cirious_codex_term::Style;

assert_eq!(Style::Bold.to_str(), "\x1b[1m");

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Style

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Style

Source§

impl Debug for Style

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Style

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Style

Source§

impl PartialEq for Style

Source§

fn eq(&self, other: &Style) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Style

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnsafeUnpin for Style

§

impl UnwindSafe for Style

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> StyleExt for T
where T: Display,

Source§

fn color(self, color: Color) -> StyledText<T>

Applies a foreground color to the text.
Source§

fn bg(self, color: Color) -> StyledText<T>

Applies a background color to the text.
Source§

fn black(self) -> StyledText<T>

Formats the text with a black foreground. Read more
Source§

fn red(self) -> StyledText<T>

Formats the text with a red foreground. Read more
Source§

fn green(self) -> StyledText<T>

Formats the text with a green foreground. Read more
Source§

fn yellow(self) -> StyledText<T>

Formats the text with a yellow foreground. Read more
Source§

fn blue(self) -> StyledText<T>

Formats the text with a blue foreground. Read more
Source§

fn magenta(self) -> StyledText<T>

Formats the text with a magenta foreground. Read more
Source§

fn cyan(self) -> StyledText<T>

Formats the text with a cyan foreground. Read more
Source§

fn white(self) -> StyledText<T>

Formats the text with a white foreground. Read more
Source§

fn rgb(self, r: u8, g: u8, b: u8) -> StyledText<T>

Formats the text with a red foreground. Read more
Source§

fn bold(self) -> StyledText<T>

Formats the text with a bold style. Read more
Source§

fn italic(self) -> StyledText<T>

Formats the text with a italic style. Read more
Source§

fn underline(self) -> StyledText<T>

Formats the text with a underline style. Read more
Formats the text with a blink style. Read more
Source§

fn strikethrough(self) -> StyledText<T>

Formats the text with a strikethrough style. Read more
Source§

fn dim(self) -> StyledText<T>

Formats the text with a dim style. Read more
Source§

fn reset(self) -> StyledText<T>

Resets the text styles. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.