[−][src]Enum crossterm_style::Attribute
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.
Attribute | Windows | UNIX | Notes |
---|---|---|---|
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 | ✓ | ✓ | |
Hidden | ✓ | ✓ | Also known as Conceal. |
Fraktur | ✗ | ✓ | Legible 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
Resets all the attributes.
Increases the text intensity.
Decreases the text intensity.
Emphasises the text.
Underlines the text.
Makes the text blinking (< 150 per minute).
Makes the text blinking (>= 150 per minute).
Swaps foreground and background colors.
Hides the text (also known as Conceal).
Crosses the text.
Sets the Fraktur typeface.
Mostly used for mathematical alphanumeric symbols.
Turns off the Bold
attribute.
Switches the text back to normal intensity (no bold, italic).
Turns off the Italic
attribute.
Turns off the Underlined
attribute.
Turns off the text blinking (SlowBlink
or RapidBlink
).
Turns off the Reverse
attribute.
Turns off the Hidden
attribute.
Turns off the CrossedOut
attribute.
Makes the text framed.
Makes the text encircled.
Draws a line at the top of the text.
Turns off the Frame
and Encircled
attributes.
Turns off the OverLined
attribute.
Trait Implementations
impl Clone for Attribute
[src]
impl Copy for Attribute
[src]
impl Eq for Attribute
[src]
impl Ord for Attribute
[src]
fn cmp(&self, other: &Attribute) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Attribute> for Attribute
[src]
impl PartialOrd<Attribute> for Attribute
[src]
fn partial_cmp(&self, other: &Attribute) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Display for Attribute
[src]
impl Debug for Attribute
[src]
impl Hash for Attribute
[src]
Auto Trait Implementations
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnwindSafe for Attribute
impl RefUnwindSafe for Attribute
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,