VIC-20 Colour Codes: More Than a Cheat Sheet

A VIC-20 colour chart looks like a list of sixteen choices. Look closer and it becomes a map of the machine: which colours belong to the border, which reach ordinary text, and why a single BASIC command can change the whole mood of the screen.

Illustrated VIC-20 beside a CRT with labels identifying its cyan border, white background and blue text, plus a POKE 36879,27 reference card.
VIC-20 colour controls connect BASIC commands to the screen.

A table that hides a system

At first glance, a VIC-20 colour chart looks like something you tack beside the monitor: black is 0, white is 1, red is 2. But those numbers reveal more than a palette. They lead into the machine’s memory map and the engineering choices behind its display.

The useful question is cyan where? In the border, behind the text, or in the next word you print? The VIC-20 handles those jobs differently. Understanding the distinction turns a mysterious BASIC listing into something you can explain, change and use in your own programs.

Sixteen colours, different possibilities

The palette below follows Commodore’s colour numbering. [1]

VIC-20 colour codes
Code Colour Code Colour
0Black8Orange
1White9Light orange
2Red10Pink
3Cyan11Light cyan
4Purple12Light purple
5Green13Light green
6Blue14Light blue
7Yellow15Light yellow

Ordinary character foregrounds and the border use codes 0–7. The screen background and auxiliary colour accept 0–15. [1] The auxiliary colour is a shared colour used in multicolour graphics. [2]

So orange is available as a background colour, but it is not an ordinary text-colour choice. The destination matters as much as the number. That uneven allocation is one of the small compromises that makes the VIC-20 worth investigating.

The byte behind the border

Location 36879 ($900F in hexadecimal) packs three controls into one byte: bits 7–4 select the background, bit 3 controls normal or inverted character display, and bits 2–0 select the border. Setting bit 3 to 1 selects normal display for ordinary characters. [1] [2]

Each group is a bit field: part of a stored value assigned a particular job. Three bits provide eight possible values; four bits provide sixteen. The border gets three bits, while the background gets four. That allocation explains their different colour ranges.

For normal display, the register value is 16*S+8+B, where S is the background code from 0–15 and B is the border code from 0–7. Type this complete example and press Return:

S=1:B=3:POKE 36879,16*S+8+B

This selects a white background and cyan border: 16*1+8+3 = 27. Multiplying the background code by 16 places it in the upper four bits; adding 8 selects normal display, and adding the border code fills the lower three bits.

Try changing S to 0 and B to 0. The resulting value is 8, giving a black background and border. [1] Existing black characters may become difficult to see; the next example explicitly chooses white text.

One number describes the arrangement, but you do not have to memorise every combination. Breaking it into fields makes the number understandable. It also explains why adding one repeatedly can produce unexpected changes: eventually, the count crosses from one field into another.

What BASIC actually sees

BASIC 2.0 has no built-in COLOR statement. Instead, POKE writes a value to a memory address. Location 646 sets the colour of subsequent printed characters, rather than recolouring text already on the screen. [1]

10 POKE 36879,8
20 POKE 646,1
30 PRINT CHR$(147)
40 PRINT "WHITE ON BLACK"
50 POKE 646,2
60 PRINT "RED MESSAGE"
70 POKE 646,1

Enter the numbered lines, then type RUN. The program selects a black screen and border, chooses white printing, and clears the screen with CHR$(147). It then prints a white message followed by a red one. Line 70 returns subsequent printing to white.

Afterwards, restore the familiar white screen, cyan border and blue printing with:

POKE 36879,27:POKE 646,6

A prompt, status line or warning can be built from the same sequence: choose a colour, print the message, then restore the printing colour if necessary. That last step matters because the setting remains in effect for later output.

Colour can also help you follow a program’s progress. A red message might mark a failed check; a different prompt might show that the program is waiting for input. A few visible changes can make otherwise hidden program state easier to understand.

Why choosing orange can switch the display mode

Putting a value from 8–15 into a character’s four-bit colour value, or nibble, selects multicolour mode. It does not unlock eight extra ordinary text colours. The lower three bits still select a foreground colour from 0–7; the remaining bit changes how the character’s pattern is interpreted. [2]

In multicolour mode, character data is read in pairs of bits, producing four wider pixels per eight-bit row instead of eight narrow ones. Those pairs select among the background, border, character foreground and auxiliary colours. [2]

This explains a potentially baffling experiment. A value that means orange in the background register means something different in a character’s colour nibble: it selects multicolour mode with black as the individual foreground colour. The number is valid, but its meaning depends on where you put it.

Colour RAM stores a colour/mode nibble for each character position; location 646 supplies the current printing choice. [1] [2] Direct colour-RAM experiments therefore need the correct memory layout for the machine’s configuration. The examples here avoid relying on fixed screen-memory or colour-RAM addresses.

A reference that teaches a way of thinking

“White background, cyan border” sounds like an aesthetic choice. The number 27 shows how that choice becomes stored state. Reading the two together reveals a small piece of the engineering behind the screen.

That is the lasting attraction of investigating BASIC on vintage microcomputers. A short command can expose a design decision, and a limitation can become an invitation to experiment. The colour chart is useful beside the monitor, but understanding its rules lets you venture beyond it.

For a practical next step, try the separate VIC-20 graphics lesson. Keep one question beside you as you experiment: which part of the display am I changing?

Writer's Notes

I found investigating this article particularly interesting because the VIC-20's colour palette reveals so much about the compromises behind vintage microcomputers. Fitting a capable computer into a small, affordable package meant making every bit of memory and hardware earn its place. Sixteen colours might sound straightforward, but the different rules for text, borders and backgrounds show how carefully those resources were allocated. Investigating these choices through BASIC helps me appreciate the ingenuity involved: even a simple POKE opens a window into the engineering decisions behind the machine.

Reader Guide

The following material expands on the terminology, historical context, technical concepts, and related reading connected to this article.

Glossary

Some of the terms used in this article have specialised, historical or technical meanings. This glossary provides additional context for selected terms and ideas.

Register
A hardware control location whose individual bits can govern different settings. On the VIC-20, register 36879 combines the background colour, normal or inverted character display, and border colour in one byte.
POKE
A BASIC command that writes a number directly to a specified memory address. On the VIC-20, it can change hardware settings such as the border and background, or set the colour used for subsequent printed characters.
Colour RAM
Memory that stores a four-bit colour and mode value, or nibble, for each character position on the VIC-20 screen. Its values determine both the character’s foreground colour and whether it is displayed in multicolour mode.
Multicolour mode
A VIC-20 character display mode selected when a character’s colour nibble is 8–15. It interprets character data in pairs of bits, producing four wider pixels per row rather than eight narrow ones.
Auxiliary colour
A shared colour used in VIC-20 multicolour graphics, selectable from all 16 palette codes. Unlike a character’s individual foreground colour, it is not chosen separately for each character position.

Frequently asked questions

Does the VIC-20 have sixteen ordinary text colours?

No. Ordinary character foregrounds use codes 0–7; background and auxiliary colour can use 0–15.

Why does POKE 36879,27 restore the familiar colours?

27 combines background 1 (white), the normal-display bit worth 8, and border 3 (cyan).

Does POKE 646 recolour the whole screen?

No. It changes the current printing colour for subsequent output.

References and further reading

  1. Commodore, VIC-20 Programmer’s Reference Guide. Archived text transcription, version 1.1, 15 March 1999. See Working with Graphics (especially p. 94), VIC chip registers (pp. 212–217), the colour table on p. 264 and Appendix B on p. 265. The transcription warns of possible errors; register bit fields were cross-checked against the chip data sheet.
  2. MOS Technology, 6560/6561 Video Interface Chip, data sheet marked 2/80. Archived scan (PDF). See control registers E/F and Color Operating Modes, PDF pp. 4–6.

Sources checked 14 November 2026. The interpretation of colour as an interface to machine state is editorial analysis.

Disclosure

This article draws on Commodore documentation and archived technical references, with AI-assisted research and drafting. The BASIC examples were checked against the documented register behaviour but have not been tested on original VIC-20 hardware or an emulator. Memory layouts may vary with expansion and configuration. The illustrated banner is AI-generated explanatory artwork, not a photograph or verified screen capture. This article is independently produced and is not affiliated with Commodore.

Change log

  1. [2026-11-29] Initial Release