[−][src]Enum comfy_table::Attribute
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.
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. - Inconsistent - Prefer to use NormalIntensity
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.
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]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Attribute
[src]
pub fn cmp(&self, other: &Attribute) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Attribute> for Attribute
[src]
pub fn eq(&self, other: &Attribute) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Attribute> for Attribute
[src]
pub fn partial_cmp(&self, other: &Attribute) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Attribute
[src]
impl StructuralPartialEq for Attribute
[src]
Auto Trait Implementations
impl RefUnwindSafe for Attribute
[src]
impl Send for Attribute
[src]
impl Sync for Attribute
[src]
impl Unpin for Attribute
[src]
impl UnwindSafe for Attribute
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,