[][src]Enum comfy_table::Attribute

pub enum Attribute {
    Reset,
    Bold,
    Dim,
    Italic,
    Underlined,
    SlowBlink,
    RapidBlink,
    Reverse,
    Hidden,
    CrossedOut,
    Fraktur,
    NoBold,
    NormalIntensity,
    NoItalic,
    NoUnderline,
    NoBlink,
    NoReverse,
    NoHidden,
    NotCrossedOut,
    Framed,
    Encircled,
    OverLined,
    NotFramedOrEncircled,
    NotOverLined,
}

Attributes used for styling cell content. Reexport of crossterm's Attributes enum. Represents an attribute.

Platform-specific Notes

  • Only UNIX and Windows 10 terminals do support text attributes.
  • Keep in mind that not all terminals support all attributes.
  • Crossterm implements almost all attributes listed in the SGR parameters.
AttributeWindowsUNIXNotes
Reset
Bold
Dim
Italic??Not widely supported, sometimes treated as inverse.
Underlined
SlowBlink??Not widely supported, sometimes treated as inverse.
RapidBlink??Not widely supported. MS-DOS ANSI.SYS; 150+ per minute.
Reverse
HiddenAlso known as Conceal.
FrakturLegible characters, but marked for deletion.
DefaultForegroundColor??Implementation specific (according to standard).
DefaultBackgroundColor??Implementation specific (according to standard).
Framed??Not widely supported.
Encircled??This should turn on the encircled attribute.
OverLined??This should draw a line at the top of the text.

Examples

Basic usage:

use crossterm::style::Attribute;

println!(
    "{} Underlined {} No Underline",
    Attribute::Underlined,
    Attribute::NoUnderline
);

Style existing text:

use crossterm::style::Styler;

println!("{}", "Bold text".bold());
println!("{}", "Underlined text".underlined());
println!("{}", "Negative text".negative());

Variants

Reset

Resets all the attributes.

Bold

Increases the text intensity.

Dim

Decreases the text intensity.

Italic

Emphasises the text.

Underlined

Underlines the text.

Makes the text blinking (< 150 per minute).

Makes the text blinking (>= 150 per minute).

Reverse

Swaps foreground and background colors.

Hidden

Hides the text (also known as Conceal).

CrossedOut

Crosses the text.

Fraktur

Sets the Fraktur typeface.

Mostly used for mathematical alphanumeric symbols.

NoBold

Turns off the Bold attribute. - Inconsistent - Prefer to use NormalIntensity

NormalIntensity

Switches the text back to normal intensity (no bold, italic).

NoItalic

Turns off the Italic attribute.

NoUnderline

Turns off the Underlined attribute.

Turns off the text blinking (SlowBlink or RapidBlink).

NoReverse

Turns off the Reverse attribute.

NoHidden

Turns off the Hidden attribute.

NotCrossedOut

Turns off the CrossedOut attribute.

Framed

Makes the text framed.

Encircled

Makes the text encircled.

OverLined

Draws a line at the top of the text.

NotFramedOrEncircled

Turns off the Frame and Encircled attributes.

NotOverLined

Turns off the OverLined attribute.

Implementations

impl Attribute[src]

Attributes used for styling cell content. Reexport of crossterm's Attributes enum.

pub const fn bytes(self) -> u32[src]

Returns a u32 with one bit set, which is the signature of this attribute in the Attributes bitset.

The +1 enables storing Reset (whose index is 0) in the bitset Attributes.

pub fn sgr(self) -> i16[src]

Returns the SGR attribute value.

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

impl Attribute[src]

Attributes used for styling cell content. Reexport of crossterm's Attributes enum.

pub fn iterator() -> impl Iterator<Item = Attribute>[src]

Iterates over all the variants of the Attribute enum.

Trait Implementations

impl Clone for Attribute[src]

impl Copy for Attribute[src]

impl Debug for Attribute[src]

impl Display for Attribute[src]

impl Eq for Attribute[src]

impl Hash for Attribute[src]

impl Ord for Attribute[src]

impl PartialEq<Attribute> for Attribute[src]

impl PartialOrd<Attribute> for Attribute[src]

impl StructuralEq for Attribute[src]

impl StructuralPartialEq for Attribute[src]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.