Smith::UI::Style
Inherits Struct < Value < Object
The smallest unit of styled terminal text. Styles are merged while a line is assembled, so markdown rendering can layer emphasis on top of a block's base style without knowing about it.
Constants
NONE = Style.new
Constructors
new(fg : Int32 | Nil = nil, bold : Bool = false, dim : Bool = false, italic : Bool = false, underline : Bool = false, invert : Bool = false)
SourceClass methods
char_width(char : Char) : Int32
Sourcedisplay_width(text : String) : Int32
Columns a string occupies in the terminal. ASCII is 1; CJK, fullwidth forms and most emoji are 2; combining marks and zero-width characters are 0. An approximation — but the same one most terminals make.
Instance methods
ansi
Sourcebold=(bold : Bool)
Sourcebold?
Sourcedim=(dim : Bool)
Sourcedim?
Sourceinvert=(invert : Bool)
Sourceinvert?
Sourceitalic=(italic : Bool)
Sourceitalic?
Sourcemerge(other : Style) : Style
other wins wherever it is set; used to layer inline markdown styles on
top of the block style they appear in.
plain?
Sourceunderline=(underline : Bool)
Sourceunderline?
Source