SCREEN 0 has 2 bytes of information for each character on the screen. One is the ASCII value of the character, the other is the color.
Color is an ASCII value from 0-255..
Foreground color is the first 4 bits, background is the next 3 bits, blinking is the last bit.
00000000 — black on black
10000000 — blinking black on black
01110000 — black on white
11110000 — blinking black on white
*Note: This is all from memory and order might be reversed, but from what I remember, the principle is there...
I did a tutorial on all this before. Let me see if I can dig it up once again. There’s a few simple formulas you can use to get your values, if I can remember them.
Blink = COLOR \ 128
Foreground = Color MOD 16
Background = (Color - 128 * Blink) \ 16
^Those are my guess at the formula, but without testing them with code, I won’t swear they’re 100% correct... I just took my pills for the day a while ago at breakfast, and I can tell my brain is all fogged up from them. Give me a few hours for them to settle, and I’ll either hunt down my old tutorial or else work the values out again for you in a demo. ;)
EDIT:
Note 2: If blinking is off, that last bit is used for extended colors, so you can have 16 foreground, 16 background colors.
Note 3: To make the value, the color is Blink + 16 * Background + Foreground.