struct
Foundation::Attributes
- Foundation::Attributes
- Struct
- Value
- Object
Overview
The decomposed, accumulated result of parsing one or more SGR sequences.
0 (reset) clears all sequences seen up to that point.
Meta: Reopened so these methods live outside the record macro block but are still attached to the same struct.
Why do this? Because the crystal docs commands' wants_doc parser chokes on method docstring comments under the record macro.
Defined in:
foundation/ansi.cr:64foundation/ansi.cr:77
Constructors
Instance Method Summary
- #bg : SGRColor | Nil
- #clone
- #copy_with(flags _flags = @flags, underline _underline = @underline, fg _fg = @fg, bg _bg = @bg, reset _reset = @reset, unknown _unknown = @unknown)
- #fg : SGRColor | Nil
- #flags : SGRFlags
- #reset : Bool
-
#to_s(io : IO) : Nil
Serializes the attributes to an SGR escape sequence and writes it to io.
- #underline : Underline | Nil
- #unknown : Array(String)
Constructor Detail
def self.new(flags : SGRFlags = SGRFlags::None, underline : Underline | Nil = nil, fg : SGRColor | Nil = nil, bg : SGRColor | Nil = nil, reset : Bool = false, unknown : Array(String) = [] of String)
#
Instance Method Detail
def copy_with(flags _flags = @flags, underline _underline = @underline, fg _fg = @fg, bg _bg = @bg, reset _reset = @reset, unknown _unknown = @unknown)
#
def to_s(io : IO) : Nil
#
Serializes the attributes to an SGR escape sequence and writes it to io. Applies accumulated state in order.
Round-trips are intentionally semantically accurate, not byte-accurate.