module

CRT::Ncurses::Formatter

Constants

ALIGNMENTS = {"C" => CRT::Ncurses::CENTER, "center" => CRT::Ncurses::CENTER, "R" => CRT::Ncurses::RIGHT, "right" => CRT::Ncurses::RIGHT, "L" => CRT::Ncurses::LEFT, "left" => CRT::Ncurses::LEFT}

Alignment tag names

ATTRIBUTES = {"b" => LibNCurses::Attribute::Bold, "bold" => LibNCurses::Attribute::Bold, "u" => LibNCurses::Attribute::Underline, "underline" => LibNCurses::Attribute::Underline, "dim" => LibNCurses::Attribute::Dim, "rev" => LibNCurses::Attribute::Reverse, "reverse" => LibNCurses::Attribute::Reverse, "so" => LibNCurses::Attribute::Standout, "standout" => LibNCurses::Attribute::Standout, "bk" => LibNCurses::Attribute::Blink, "blink" => LibNCurses::Attribute::Blink}

Built-in attribute names (short and long forms)

Class methods

parse(string : String) : Tuple(Array(Int32), Int32, Int32)

Parse a BBCode-style format string into a chtype array.

Syntax: [b] or [bold] — bold on [u] or [underline] — underline on [dim] — dim on [rev] or [reverse] — reverse on [so] or [standout] — standout on [bk] or [blink] — blink on [#FF] — foreground color (hex 00-FF) [##B0] — background color (hex 00-FF) [b #FF ##00] — combined attributes and colors [/] — pop last style [//] — reset all styles [stylename] — apply registered style [ — literal open bracket [C] or [center] — center alignment (at string start only) [R] or [right] — right alignment (at string start only) [L] or [left] — left alignment (at string start only)

Source
parse_color_token(token : String) : Tuple(Int32, Int32)

Parse a single color token and return {fg, bg}. Used by parse_tokens internally and exposed for testing.

Color notation: #XX — foreground only ##XX — background only #XX/YY — foreground XX, background YY ##YY/XX — background YY, foreground XX

TODO: Support basic color words, e.g. #red, #red/blue, ##blue/red.

Source

Nested types