Available on:
See also: PAPER (instruction)
Alias: INK

PEN (instrucion)

The PEN command define the color that will be used to draw lines, shapes, or write text on the screen. In practice, it is like choosing the color of a pen or marker before you start drawing. Depending on the hardware capabilities of the computer, the range of colors available could be limited or very large. Some systems used predefined color palettes, while others allowed you to define your own colors.

In order to be isomorphic, the color parameter repesents a value in the available colors, from 0 to maximum (PEN 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.

So the graphics capabilities of the PEN 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 pen color for the considered target, again if no color replacement has been done.

SYNTAX

 PEN color


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

EXAMPLE

 PEN 4
 PEN esempio


ABBREVIATION: Pn

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:

PEN (instrucion) ↔ Pn

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