[−][src]Enum crossterm::Attribute
These are all the attributes which could be apply to font. There are few things to note
- Not all attributes are supported, some of them are only supported on Windows some only on Unix, and some are only very rarely supported.
- I got those attributes, descriptions, supportability from here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
- Take note of the fact that when running your program cross-platform that some attributes might not work because of their support.
- When an attribute is not supported nothing will happen with the terminal state.
Example
You can use an attribute in a write statement to apply the attribute to the terminal output.
println!( "{} Underlined {} No Underline", Attribute::Underlined, Attribute::NoUnderline );
You can also call attribute functions on a &'static str
:
use crossterm(_style)::Colorizer; println!("{}", style("Bold text").bold()); println!("{}", style("Underlined text").underlined()); println!("{}", style("Negative text").negative());
Variants
Reset
All attributes off [info]: This will reset all current set attributes. [Supportability]: Windows, UNIX.
Bold
Increased Intensity [info]: This will increase the font sensitivity also known as bold. [Supportability]: Windows, UNIX.
Dim
Decreased Intensity [info]: This will decrease the font sensitivity also known as bold. [Supportability]: Windows, UNIX.
Italic
Italic Text [info]: This will make the font italic. [Supportability]: Not widely supported, sometimes treated as inverse.
Underlined
This will draw a line under the font. [info]: An line under a word, especially in order to show its importance. [Supportability]: Windows, UNIX
SlowBlink
Slow Blinking Text [info]: Blink Less than 150 per minute. [Supportability]: UNIX
RapidBlink
Slow Blinking Text [info]: MS-DOS ANSI.SYS; 150+ per minute; [Supportability]: Not widely supported
Reverse
Swap foreground and background colors [info]: swap foreground and background colors [Supportability]: Windows, UNIX
Hidden
Hide font [info]:
- This will make the font hidden.
- Also known as 'Conceal' [Supportability]: Windows, UNIX
CrossedOut
Cross-out font [info]: Characters legible, but marked for deletion. [Supportability]: UNIX
Fraktur
The Fraktur is a typeface belonging to the group of Gothic typefaces. [info]: https://nl.wikipedia.org/wiki/Fraktur [Supportability]: Rarely supported
NoBold
This will turn off the bold attribute. [info]:
- Double-underline per ECMA-48.
- WikiPedia: https://en.wikipedia.org/wiki/Talk:ANSI_escape_code#SGR_21%E2%80%94%60Bold_off%60_not_widely_supported
- Opposite of
Bold
(1) [Supportability]: not widely supported
NoUnderline
This will turn off the underline attribute. [info]:
- Not singly or doubly underlined will be turned off.
- Opposite of
Underlined.
(4) [Supportability]: Windows, UNIX
NoBlink
This will turn off the blinking attribute
[info]: Opposite of Slow and Rapid blink.
(5,6)
[Supportability]: Unknown
NoInverse
This will turn off the reverse attribute.
[info]: Opposite of Reverse
(7)
[Supportability]: Windows, unknown
NoHidden
This will make the font visible.
[info]: Opposite of Hidden
(8)
[Supportability]: Unknown
NotCrossedOut
This will turn off the crossed out attribute.
[info]: Opposite of CrossedOut
(9)
[Supportability]: Not widely supported
DefaultForegroundColor
This will reset the foreground color to default. [info]: Implementation defined (according to standard) [Supportability]: Unknown
DefaultBackgroundColor
This will reset the background color to default. [info]: Implementation defined (according to standard) [Supportability]: Unknown
Framed
Framed font. [Supportability]: Not widely supported
Encircled
This will turn on the encircled attribute.
OverLined
This will draw a line at the top of the font. [info]: Implementation defined (according to standard) [Supportability]: Unknown
NotFramedOrEncircled
This will turn off the framed or encircled attribute.
NotOverLined
This will turn off the overLined attribute.
[info]: Opposite of OverLined
(7)
[Supportability]: Windows, unknown
Trait Implementations
impl Copy for Attribute
[src]
impl Ord for Attribute
[src]
fn cmp(&self, other: &Attribute) -> Ordering
[src]
default fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
default fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
default fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl Clone for Attribute
[src]
fn clone(&self) -> Attribute
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Attribute
[src]
impl PartialOrd<Attribute> for Attribute
[src]
fn partial_cmp(&self, other: &Attribute) -> Option<Ordering>
[src]
#[must_use]
default fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
default fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
default fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
default fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Display for Attribute
[src]
impl Debug for Attribute
[src]
impl PartialEq<Attribute> for Attribute
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,