Colorful Tomo Library
This is a library for Tomo that lets you write colorful text for the terminal without having to stress about managing state for color highlighting.
Grammar
The grammar looks like this:
1 colorful <- ("@(at)" / "@(lparen)" / "@(rparen)" # Escapes2 / "@(" attributes ":" colorful ")" # Colorful text3 / .)* # Plain text5 attributes <- (attribute ("," attribute)*)?7 attribute <- color # Color defaults to foreground8 / "fg=" color # Foreground color9 / "bg=" color # Background color10 / "ul=" color # Underline color11 / "b" / "bold"12 / "d" / "dim"13 / "u" / "underline"14 / "i" / "italic"15 / "B" / "blink"16 / "r" / "reverse"17 # These are rarely supported by terminals:18 / "fraktur"19 / "frame"20 / "encircle"21 / "overline"22 / "super" / "superscript"23 / "sub" / "subscript"25 color <- "black" / "red" / "green" / "yellow" / "blue" / "magenta" / "cyan" / "white"26 # All caps colors are "bright" colors (not always supported):27 / "BLACK" / "RED" / "GREEN" / "YELLOW" / "BLUE" / "MAGENTA" / "CYAN" / "WHITE"28 / "default"29 / "#" 6 hex # Values 0x000000-0xFFFFFF30 / "#" 3 hex # Values 0x000-0xFFF31 / 1-3 digit # Values 0-255