struct Foundation::Attributes

Overview

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:64
foundation/ansi.cr:74

Constructors

Instance Method Summary

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) #

[View source]

Instance Method Detail

def bg : SGRColor | Nil #

def clone #

[View source]
def copy_with(flags _flags = @flags, underline _underline = @underline, fg _fg = @fg, bg _bg = @bg, reset _reset = @reset, unknown _unknown = @unknown) #

[View source]
def fg : SGRColor | Nil #

def flags : SGRFlags #

def reset : Bool #

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-trip is semantically accurate, not byte-accurate.


[View source]
def underline : Underline | Nil #

def unknown : Array(String) #