class
Foundation::Style
- Foundation::Style
- Reference
- Object
Overview
Build a Select Graphic Rendition (SGR) escape sequence by accumulating parameters. Mutating is chainable, each method appends and returns self.
Defined in:
foundation/sgr.crConstructors
-
.new
Create an empty builder with no parameters set.
Instance Method Summary
-
#background(color : SGRColor) : self
Appends a background color resolved to its SGR kind (eg basic/indexed/rgb/default).
-
#background_basic(index : UInt8) : self
Set a basic bg color by index 0..15 (SGR 40-37 / 100-107 bright).
-
#background_indexed(index : UInt8) : self
Sets a 256-color bg by palette index (SGR 48;5;index)
-
#background_rgb(r : UInt8, g : UInt8, b : UInt8) : self
Sets a truecolor bg (SGR 48;2;r;g;b)
-
#blink : self
Enable blink (SGR 5)
-
#bold : self
Enable bold (SGR 1)
-
#default_background : self
Resets the bg to terminal default (SGR 49)
-
#default_foreground : self
Resets fg to terminal default (SGR 39)
-
#faint : self
Enable faint/dim (SGR 2)
-
#foreground(color : SGRColor) : self
Appends a foreground color resolved to its SGR kind (eg basic/indexed/rgb/default).
-
#foreground_basic(index : UInt8) : self
Set a basic fg color by index 0..15 (SGR 30-37 / 90-97 bright).
-
#foreground_indexed(index : UInt8) : self
Sets a 256-color fg by palette index (SGR 38;5;index)
-
#foreground_rgb(r : UInt8, g : UInt8, b : UInt8) : self
Sets a truecolor fg (SGR 38;2;r;g;b)
-
#italic : self
Enable italic (SGR 3)
-
#raw(param : String) : self
Appends a raw SGR parameter as-is, for params that the typed setters don't model.
-
#reset : self
Resets all attributes (SGR 0)
-
#reverse : self
Enable reverse which swaps fg and bg (SGR 7)
-
#strikethrough : self
Enable strikethrough (SGR 9)
-
#to_s(io : IO) : Nil
Renders the accumulated params as a `CSI ...
-
#underline : self
Enable single underline (SGR 4)
-
#underline_style(style : Underline) : self
Enable underline of given substyle (SGR 4:n)
Constructor Detail
Instance Method Detail
Appends a background color resolved to its SGR kind (eg basic/indexed/rgb/default).
Set a basic bg color by index 0..15 (SGR 40-37 / 100-107 bright).
Raises if index > 15
Sets a 256-color bg by palette index (SGR 48;5;index)
Appends a foreground color resolved to its SGR kind (eg basic/indexed/rgb/default).
Set a basic fg color by index 0..15 (SGR 30-37 / 90-97 bright).
Raises if index > 15
Sets a 256-color fg by palette index (SGR 38;5;index)
Appends a raw SGR parameter as-is, for params that the typed setters don't model.
Renders the accumulated params as a CSI ... m sequence.
Or nothing if no params are set.
Enable underline of given substyle (SGR 4:n)