struct
TermBuf::Style
- TermBuf::Style
- Struct
- Value
- Object
Overview
Everything about a cell other than the character in it.
Styles are values, so they compare and hash by content. StyleTable
interns them, which is what lets a Cell carry a four byte id instead of
this whole struct.
Defined in:
termbuf/core/style.crConstant Summary
-
DEFAULT =
new -
The style a freshly cleared terminal is in.
Constructors
Instance Method Summary
-
#attributes : Attributes
Everything a cell can be at once.
-
#background : Color
Cell colour behind the text.
-
#bg(color : Color) : Style
A copy with a different background.
-
#blink(rapid : Bool = false) : Style
A copy that blinks, slowly unless rapid.
-
#bold : Style
A copy with the bold attribute set.
-
#conceal : Style
A copy the terminal renders as blanks.
-
#copy_with(foreground : Color = @foreground, background : Color = @background, underline_color : Color = @underline_color, attributes : Attributes = @attributes, underline : Underline = @underline, link : UInt32 = @link) : Style
Returns a copy with the named fields replaced.
-
#default? : Bool
Whether this is the untouched style, which needs no escape sequence.
-
#faint : Style
A copy with the faint attribute set.
-
#fg(color : Color) : Style
A copy with a different text colour.
-
#foreground : Color
Text colour.
-
#has?(flags : Attributes) : Bool
Whether every attribute in flags is set.
-
#ink? : Bool
Whether the cell paints anything other than its background.
-
#italic : Style
A copy with the italic attribute set.
-
#link : UInt32
OSC 8 hyperlink id, or zero for no link.
-
#linked(id : UInt32) : Style
A copy carrying OSC 8 link id.
-
#reverse : Style
A copy with foreground and background swapped by the terminal.
-
#strike : Style
A copy with the strike-through attribute set.
-
#to_s(io : IO) : Nil
Same as
#inspect(io). -
#underline : Underline
Which of the underline styles, if any.
-
#underline_color : Color
Colour of the underline, when the terminal supports colouring it separately from the text.
-
#underlined(style : Underline = Underline::Single, color : Color = @underline_color) : Style
A copy carrying an underline.
-
#with(flags : Attributes) : Style
Returns a copy with flags added.
-
#without(flags : Attributes) : Style
Returns a copy with flags removed.
Constructor Detail
Instance Method Detail
Returns a copy with the named fields replaced.
Whether the cell paints anything other than its background. A cell that does not is interchangeable with a blank of the same background, which is what lets the painter reach for an erase instead of writing spaces.
OSC 8 hyperlink id, or zero for no link. Populated once link support lands; the buffer carries it through in the meantime.
Colour of the underline, when the terminal supports colouring it separately from the text.
A copy carrying an underline. Terminals without ExtendedUnderline
render every style as a plain one, and without UnderlineColor ignore
color.