Ansi::Style
Style represents an ANSI SGR (Select Graphic Rendition) style.
Constants
Underline styles constants (deprecated aliases for compatibility)
Underline styles constants.
More deprecated constants
Constructors
Instance methods
BackgroundColor appends the background color style attribute to the style. If c is nil, the default background color is used.
Blink appends the slow blink or no blink style attribute to the style. When v is true, text blinks slowly (less than 150 per minute). When false, blinking is disabled.
Conceal appends the conceal or no conceal style attribute to the style. When v is true, text is hidden/concealed. When false, concealment is disabled.
DefaultBackgroundColor appends the default background color style attribute to the style.
DefaultForegroundColor appends the default foreground color style attribute to the style.
Deprecated: use #foreground_color(nil) instead.
DefaultUnderlineColor appends the default underline color style attribute to the style.
Deprecated: use #underline_color(nil) instead.
ForegroundColor appends the foreground color style attribute to the style. If c is nil, the default foreground color is used.
Italic appends the italic or no italic style attribute to the style. When v is true, text is rendered in italic. When false, italic is disabled.
NoBlink appends the no blink style attribute to the style.
Deprecated: use #blink(false) or #rapid_blink(false) instead.
NoConceal appends the no conceal style attribute to the style.
Deprecated: use #conceal(false) instead.
NoItalic appends the no italic style attribute to the style.
Deprecated: use #italic(false) instead.
NoReverse appends the no reverse style attribute to the style.
Deprecated: use #reverse(false) instead.
NoStrikethrough appends the no strikethrough style attribute to the style.
Deprecated: use #strikethrough(false) instead.
NoUnderline appends the no underline style attribute to the style.
Deprecated: use #underline(false) instead.
Normal appends the normal intensity style attribute to the style. This resets Bold and Faint attributes.
RapidBlink appends the rapid blink or no blink style attribute to the style. When v is true, text blinks rapidly (150+ per minute). When false, blinking is disabled. Note that this is not widely supported in terminal emulators.
Reset appends the reset style attribute to the style. This resets all formatting attributes to their defaults.
Reverse appends the reverse or no reverse style attribute to the style. When v is true, foreground and background colors are swapped. When false, reverse video is disabled.
Strikethrough appends the strikethrough or no strikethrough style attribute to the style. When v is true, text is rendered with a horizontal line through it. When false, strikethrough is disabled.
Styled returns a styled string with the given style applied. The style is applied at the beginning and reset at the end of the string.
String returns the ANSI SGR (Select Graphic Rendition) style sequence for the given style.
Underline appends the underline or no underline style attribute to the style. When v is true, text is underlined. When false, underline is disabled.
UnderlineColor appends the underline color style attribute to the style. If c is nil, the default underline color is used.
UnderlineStyle appends the underline style attribute to the style. Supports various underline styles including single, double, curly, dotted, and dashed.