How to set the text and background colour on a C64

Commodore LogoTo set the background colour on your beloved old C64 (and C128 in 40 column mode) you have to POKE the colour value into two registers, one for the background and one for the border. The poor little guy only had 16 colour values, 0 for black, 1 for white, etc.

To change the background to black:

  • poke 53280,0 (for the border)
  • poke 53281,0 (for the background)

Likewise you can read the current background colour out using PEEK:

  • bo = peek (53280)
  • bg = peek (53281)

The text colour has to be set before any text is written. You can do this either by PRINTing the PETSCII character which will come up automatically once you type the first quote (and stop appearing when you type the second) – much like you can print cursor commands. It’s tacky, but it works.

Another (perhaps better) way is to print a colour value using PRINT CHR$(x), where x is the value of the colour you’d like to write in.

Yet another way would be to set the colour for each existing character on the screen, starting at 55296 via POKE (you’d have to do this 1024 times, once for every character).

Refer to this handy table for all C64 colour values – courtesy of the C64 Wiki:

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

6 thoughts on “How to set the text and background colour on a C64

  1. I use this to set the background & text the way I like it..


    It works nicely as a single line but you could do it in 3 if you wanted to..

    10 POKE 53280,0 – black frame
    20 POKE 53281,0 – black background
    30 POKE 646,14 – light blue text

Add your voice!