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 background)
  • poke 53281,0 (for the border)

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

  • bg = peek (53280)
  • br = 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:

Jay is founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or drawing on tablet devices. He blogs about his coding journey at and

You can leave a comment on my original post.