Available on:
See also: PEN (instruction) PAPER (function)

PAPER (instruction)

The PAPER command define the background color of the screen. Imagine having a blank sheet of paper to draw on: with PAPER, you can choose the color of this sheet, turning it into a colored sheet, lined or squared, depending on your preferences and the capabilities of your computer.

The parameter color is represented by a value in the available colors, from 0 to maximum (PAPER COLORS). For the very specific reasons, each color is encoded by a literal constant, like WHITE or YELLOW. Those constants will be replaced by proper color index or values, depending on the hardware. Obviously, you can directly put the numeric value for the color, but you have to know the underlying encoding of the colors.

By combining the background color (defined with PAPER) with the color of the text or lines (defined with PEN), you can create interesting visual effects and improve the readability of your programs. You can also use PAPER to create colored backgrounds that simulate different environments, such as a starry sky, a green meadow or a blue ocean. In simple games, PAPER allows you to define the game background, creating a more immersive atmosphere.

So the graphics capabilities of the PAPER command are closely tied to the capabilities of the target running the program. The resolution of the screen affected the quality of the colors displayed. On lower-resolution screens, colors could appear less sharp. Some systems offers a wider color gamut and more flexibility in defining colors. Others use a limited color palette could result in some uniformity in the colors available. In some target you can define your own palettes, so there is no guarantee that the constants and values are the same.

You can use the DEFAULT constant to use the default paper color for the considered target, again if no color replacement has been done.

SYNTAX

 PAPER color


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

 PAPER GREEN
 PAPER colore


ABBREVIATION: Pa

Join BASIC 10Liner Contest with ugBASIC!

An interesting competition is held at the beginning of each year: the BASIC 10Liner Contest. It is possible to use ugBASIC to participate in the next "BASIC10Liner" competition, in the following categories:

  • PUR-120 - A game in 10 lines of max 120 characters (w/abbrev.)
  • EXTREME-256 - A game in 10 lines of max 256 characters (w/abbrev.)
  • SCHAU - Any program in 10 lines of max 256 characters (w/abbrev.)
In order to reduce space you can use this abbreviation for this instruction:

PAPER (instruction) ↔ Pa

Any problem?

If you have found a problem with this keyword, if you think there is a bug or, more simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!

open an issue BACK TO KEYWORDS