ANSI codes
Nov. 24th, 2025 05:42 pmFor the past few years I've grown increasingly interested in using ANSI codes. They are codes that can make ordinary text do very interesting things, such as display in bold, italic, underlined, in color, or on a colored background. It can also do things like delete a word, or to the end of the line, or to the beginning of a line, or the entire line. It can move the cursor to a specific point on the screen, and many other things. Way back, decades ago, when I had my Amiga I used to play around with ANSI codes, but they have largely fallen out of fashion. As I say, in recent years my interest in them has renewed. Here is a file I refer to a lot, so much so, in fact, that I keep it on my desktop:
See here:
https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
for a much more complete list of ANSI codes, including delete codes, cursor movement codes, assigning strings to keys, and much more.
NOTE: 'ESC' is the escape character. ESC[0m normal display (clear all F/X, use normal colors) ESC[1m bold (bright colours in older rxvt) ESC[2m dim or faint ESC[3m italics (+ bright in some rxvt, not older ones) ESC[4m underline ESC[5m slow blink (or bright colours or bold) ESC[6m rapid blink ESC[7m reverse (swap background/foreground colors) ESC[8m conceal (hidden) ESC[9m strike through ESC[21m double underline (or reset bold) ESC[22m normal intensity (not bold, not faint) ESC[23m not italic ESC[24m not underline ESC[25m not blinking ESC[26m ??? ESC[27m not reversed ESC[28m reveal (not concealed) ESC[29m not strike through ESC[3*m fg color (replace * with number below) ESC[9*m fg bright color (replace * with number below) ESC[4*m bg color (replace * with number below) ESC[10*m bg bright color (replace * with number below) * color bright color --- ----- ------------ 0 black dark grey 1 red bright red 2 green bright green 3 orange yellow 4 dark blue bright blue 5 violet bright violet 6 cyan bright cyan 7 light grey white Commands can be combined: ESC[5;1;33;40m Literal ESC character: shell scripts: echo -e "\e" sed \x1b or \d27 or \o33 or \c[ awk \033 or \x1b rxvt or vi/vim/gvim press CTRL-V then the ESC key. For more ANSI info study the output of 'infocmp' command.
See here:
https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
for a much more complete list of ANSI codes, including delete codes, cursor movement codes, assigning strings to keys, and much more.