Pencil Code Reference > color names
The CSS standard has 140 named colors (and 10 alternate color names).
Click a color to try it.
These colors can be used when drawing with
pen
,
dot
,
box
,
fill
,
or when using CSS properties.
Colors can also be created using numbers, using
the rgb
and hsl
functions.
It is possible to use semitransparent colors
using rgba(r,g,b,a)
instead of rgb(r,g,b)
.
r
, g
, and b
stand for "red", "green", and "blue" respectively,
and they represent a value from 0 to 255, specifying the intensity of
each hue. The fourth number, a
, is known as "alpha" and is the opacity
of the color.
Alpha of 1 is fully opaque, and anything less than 1
is like painting with watercolor. Alpha 0 is fully
transparent. The special color name
transparent
stands for rgb(0,0,0,0)
.
Drawing with transparent
leaves the canvas perfectly
unchanged.
Using pen white
is like using opaque white paint:
it covers any color with white, but it does not return
the canvas to its original transparent state.
The turtle drawing functions support a pseudo-color name
called erase
. When drawing with pen erase
, the
canvas is erased of color under the turtle and made transparent again.
When using erase
, the pen is slightly enlarged
so that lines can be cleanly erased without leaving stray pixels.
↑