┌───────────────────────┐
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
│                       │
└───────────────────────┘
ANSI Ink for Philes
~ CuB3y0nd
──[ Summary ]───────────────────────────────────────────────────────────────────

  This phile demonstrates the chromatic syntax supported by Entropic:

    inline  : #[role|text]
    block   : ink header + | text + ~ mask lines
    palette : ANSI 16-color foreground only

  The syntax is intentionally small.  It colors characters; it does not invent
  semantic roles, binary-specific aliases, or Markdown-like decoration.

──[ 0 ]───────────────────────────────────────────────────────────────[ inline ]

  Inline ink uses a single form:

    #[r|red] #[g|green] #[y|yellow] #[b|blue] #[m|magenta] #[c|cyan]

  Bright colors use uppercase short names or explicit bright-* names:

    #[R|bright red] #[G|bright green] #[Y|bright yellow] #[B|bright blue]
    #[M|bright magenta] #[C|bright cyan] #[K|bright black] #[W|bright white]

  Long ANSI names are accepted too:

    #[red|red] #[green|green] #[yellow|yellow] #[blue|blue]
    #[magenta|magenta] #[cyan|cyan] #[black|black] #[white|white]

  Literal syntax is escaped with a backslash:

    #[r|this is not colored]
    escape the pipe like this: |
    escape the close bracket like this: ]

──[ 1 ]──────────────────────────────────────────────────────────────[ palette ]

  Short aliases:

    k black        r red          g green        y yellow
    b blue         m magenta      c cyan         w white

  Bright aliases:

    K bright-black R bright-red   G bright-green Y bright-yellow
    B bright-blue  M bright-magenta C bright-cyan W bright-white

  Rendered swatches:

    BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE
    BRIGHT-BLACK BRIGHT-RED BRIGHT-GREEN BRIGHT-YELLOW
    BRIGHT-BLUE BRIGHT-MAGENTA BRIGHT-CYAN BRIGHT-WHITE

──[ 2 ]────────────────────────────────────────────────────────────[ ink block ]

  Ink blocks are for byte maps, hexdumps, ASCII diagrams, and dense annotations
  where inline syntax would make the source unreadable.

 00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00

  R = magic bytes, C = class, G = endian/version,
  K = padding.

 p_flags: 00000005    PF_R | PF_X

  green bits are set.  red marks the executable permission.

 rsp -> 41 41 41 41 41 41 41 41  90 10 40 00 00 00 00 00

  Y = controlled padding, C = return target, K = zero bytes.

──[ 3 ]───────────────────────────────────────────────────────────────[ source ]

  The previous ELF example was written as:

    | 00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00
    ~ ........  RR RR RR RR CC GG GG KK  KK KK KK KK KK KK KK KK

  The renderer strips the | prefix, consumes the ~ mask line, and renders only
  the text line.  A dot or space in the mask leaves that character uncolored.

──[ 4 ]─────────────────────────────────────────────────────────────[ debugger ]

  Inline ink is better when the interesting spans are sparse:

    pwndbg> x/gx $rsp
    0x7fffffffe3d8: 0x4141414141414141
    0x7fffffffe3e0: 0x0000000000401090  ; saved rip

  Ink blocks are better when the interesting spans are dense:

 00400000-00401000 r--p 00000000 ./a.out
 00401000-00402000 r-xp 00001000 ./a.out
 7ffffffde000-7ffffffff000 rw-p 00000000 [stack]

  C address, G readable/writable, R executable,
  M mapped name.

──[ 5 ]────────────────────────────────────────────────────────────────[ rules ]

  Unknown roles are build errors.  This is deliberate: color should be a stable
  part of the phile format, not a free-form style attribute.

  Supported inline aliases:

    k black        r red          g green        y yellow
    b blue         m magenta      c cyan         w white
    K bright-black R bright-red   G bright-green Y bright-yellow
    B bright-blue  M bright-magenta C bright-cyan W bright-white

  Supported ink mask characters are the same short aliases:

    k r g y b m c w K R G Y B M C W

  Dots and spaces in an ink mask leave characters unchanged.