▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ░▒▓█ rapid1337.com █▓▒░ ╓──────────────────────────────────────────╖ ║ ANSI Escape Codes, the Short Version ║ ╟──────────────────────────────────────────╢ ║ The handful of escape sequences you ║ ║ actually use to colour a terminal. ║ ╟──────────────────────────────────────────╢ ║ ·· code/ansi-escapes.html ·· ║ ╙──────────────────────────────────────────╜ ============================================================================ Title ..: ANSI Escape Codes, the Short Version Author .: staff Date ...: 2026-06-10 Section : Code ============================================================================ Everything colourful in a terminal is just `ESC [` followed by a few numbers and a letter. Here's the minimum viable cheat sheet. ```c #define RESET "\x1b[0m" #define BOLD "\x1b[1m" #define FG(n) "\x1b[38;5;" #n "m" /* 256-colour foreground */ printf(FG(213) BOLD "rapid1337" RESET "\n"); ``` `38;5;n` selects a colour from the 256-colour cube; swap `38` for `48` and you set the background instead. That's 90% of what any TUI needs. ---------------------------------------------------------------------------- -- rapid1337.com -- The dumping ground for all things tech // knowledge is the weapon --