color( col )

Sets the draw color in the draw state.

The color number.

Many graphics functions accept an optional color argument. When this argument is omitted, the current color of the draw state is used by default. The color() function sets this color.

The color number corresponds to the PICO-8 palette, a value between 0 and 15. See Graphics for an illustrated table of colors.

When you provide an explicit color argument to a graphics function, PICO-8 changes the draw color to that color.

The color() function honors the alternate palette set by pal().

Technical notes Edit

The current color is memory-mapped and may be read or written directly:

  • 0x5f25: current color

Examples Edit

color(7)  -- white
circfill(20, 20, 10)
circfill(60, 60, 10)
color(8)  -- red
circfill(20, 60, 10)
circfill(60, 20, 10)
pal(7, 10)  -- white -> yellow
circfill(20, 100, 10)
circfill(60, 100, 10)
-- get the current color from its memory-mapped address

See also Edit

Community content is available under CC-BY-SA unless otherwise noted.