The ANSI Terminal specification gives programs (including BBS door games) the ability to change the text color or background color (as well as move the cursor, amoung other things)

An ansi code begins with the ESC character* (ascii 27) and a left square bracket... followed by a number (or 2 or more separated by a semicolon) and a letter.

In the case of colour codes, the trailing letter is "m"...

So as an example, we have ESC[31m ... this will change the foreground colour to red.

The codes are as follows:

1m     -     Change text to hicolour (bold) mode
4m     -        "    "   "  Underline (doesn't seem to work)
5m     -        "    "   "  BLINK!!
8m     -        "    "   "  Hidden (same colour as bg)
30m    -        "    "   "  Black
31m    -        "    "   "  Red
32m    -        "    "   "  Green
33m    -        "    "   "  Yellow
34m    -        "    "   "  Blue
35m    -        "    "   "  Magenta
36m    -        "    "   "  Cyan
37m    -        "    "   "  White
40m    -     Change Background to Black
41m    -        "       "      "  Red
42m    -        "       "      "  Green
43m    -        "       "      "  Yellow
44m    -        "       "      "  Blue
45m    -        "       "      "  Magenta
46m    -        "       "      "  Cyan
47m    -        "       "      "  White
7m     -     Change to Black text on a White bg
0m     -     Turn off all attributes.

Now for example, say I wanted blinking, yellow text on a magenta background... I'd type ESC[45;33;5m

* - The Escape character looks like an arrow pointing left, and can be produced in a hex editor, or with dos' EDIT command by typing CTRL+P and then ESC.