Enum text_terminal::AnsiStyleCodes
source · pub enum AnsiStyleCodes {
Show 40 variants
Reset,
Bright,
Dim,
Italic,
Underlined,
Blink,
BlinkRapid,
Inverse,
Hidden,
Strikethrough,
PrimaryFont,
AlternateFont(u8),
Fraktur,
DoulbeUnderlinedOrNotBright,
NotBrightNorDim,
NotItalicNorFraktur,
NotUnderlined,
NotBlink,
_ProportionalSpacing,
NotInverse,
NotHidden,
NotStrikethrough,
ForegroundColor(ForegroundColor),
BackgroundColor(BackgroundColor),
_NotProportionalSpacing,
Framed,
Circled,
Overlined,
NotFramedOrCircled,
NotOverlined,
UnderlinedColor(UnderlinedColor),
_IdeogramUnderlined,
_IdeogramDoubleUnderlined,
_IdeogramOverlined,
_IdeogramDoubleOverlined,
_IdeogramStressMarking,
_NotIdeogram,
Superscript,
Subscript,
NotSuperOrSubscript,
}
Expand description
The set of all possible ANSI escape codes for setting text style.
This is also referred to as Select Graphic Rendition (SGR) parameters or Display Attributes.
Note that terminal emulators may not support all of these codes;
in general, only the first 9 codes are supported (and their Not*
variants that disable them).
See a list of all such parameters here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
Variants§
Reset
Resets or clears all styles.
Bright
Bright or bold text.
Dim
Dim or faint text.
Italic
Italicized text.
Underlined
Underlined text.
Blink
The text will blink at slower rate, under 150 blinks per minute.
BlinkRapid
The text will blink rapidly at a fast rate, over 150 blinks per minute.
Inverse
The foreground and background colors will be swapped. The text will be displayed using the background color, while the background will be displayed using the foreground color.
Hidden
The text will be concealed/invisible and not displayed at all. Only the solid background color will be displayed.
Strikethrough
The text will be striked through, i.e., crossed out with a line through it.
PrimaryFont
Sets the font to the primary default font.
AlternateFont(u8)
Sets the font to an alternate font.
There are 10 available choices, from 0
to 9
,
in which 0
is the same as Self::PrimaryFont
.
Fraktur
Sets the font to be a blackletter font, which is a calligraphic/angular font in a gothic German style rather than the typical Roman/Latin style. Example: https://git.enlightenment.org/apps/terminology.git/commit/?id=02856cbdec511e08cf579b08e906499d9583f018
DoulbeUnderlinedOrNotBright
The text will be underlined twice, or, depending on the terminal,
this will disable Bright
.
Note: it is better to use NotBrightNorDim
to disable Bright
as that escape code is more widely supported than this one.
NotBrightNorDim
Normal font intensity: Disables Bright
or Dim
.
NotItalicNorFraktur
Normal font sytle: Disables Italic
or Fraktur
.
NotUnderlined
Disables Underline
or DoubleUnderline
.
NotBlink
Disables Blink
or BlinkRapid
.
_ProportionalSpacing
Proportional spacing, which sets the Teletex character set: https://en.wikipedia.org/wiki/ITU_T.61. This is a different text encoding that is not used and has no effect on terminals.
NotInverse
Disables Inverse
: foreground colors and background colors are used as normal.
NotHidden
Disables Hidden``: text is displayed as normal. Sometimes called reveal.
NotStrikethrough
Disables Strikethrough
: text is not crossed out.
ForegroundColor(ForegroundColor)
Set the foreground color: the color the text will be displayed in.
To set it back to the default, use ForegroundColor(Color::Default)
.
BackgroundColor(BackgroundColor)
Set the background color: the color displayed behind the text.
To set it back to the default, use BackgroundColor(Color::Default)
.
_NotProportionalSpacing
Disables _ProportionalSpacing
.
Framed
The text will be displayed with a rectangular box surrounding it.
Circled
The text will be displayed with a circle or oval surrounding it.
Overlined
The text will be overlined: displayed with a line on top (like underlined).
NotFramedOrCircled
Disables Framed
or Circled
.
NotOverlined
Disabled Overlined
.
UnderlinedColor(UnderlinedColor)
Sets the underline color.
Without this, the underline color will be the same as the text color.
To set it back to the default, use UnderlinedColor(Color::Default)
.
_IdeogramUnderlined
_IdeogramDoubleUnderlined
_IdeogramOverlined
_IdeogramDoubleOverlined
_IdeogramStressMarking
_NotIdeogram
Disables all Ideogram styles.
Superscript
Subscript
NotSuperOrSubscript
Disables Superscript
or Subscript
.