Table of Contents

ugBASIC User Manual

PEN

SYNTAX

   PEN color

PURPOSE

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 color shades. For this 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.

EXAMPLE

  PEN 4
  PEN esempio

ABBREVIATION

 Pn

AVAILABLE ON

SEE ALSO

PAPER

ALIAS FOR

INK

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY