Color of areas and surfaces
FillColor determines the color used to fill
all types of areas and surfaces.
used for color blends.
FillColors is used for objects
that need more than one color.
2D objects that have a notion of "area" and 3D
objects that have a surface support
determine the primary color to show objects in. If
the second color to blend to.
Functions and primitives displaying more than one object, such
FillColors for a list of colors used cyclically.
f := plot::Function2d(cos(2*x)+cos(x), x=-PI..PI): h := plot::Hatch(f): plot(h, f)
To change the color of the hatch, simply set the
to some other value:
h::FillColor := RGB::Grey: plot(h, f)
The default setting for a surface is to have a height-dependent
coloring with a linear blend from
s := plot::Surface([cos(2*u+v), sin(u+2*v), sin(u+v)], u = 0..2*PI, v = 0..2*PI, ULinesVisible = FALSE, VLinesVisible = FALSE): plot(s)
These colors can be manipulated in the usual way. As an example, we set the transition to a monochrome transition from opaque to transparent:
s::FillColor := RGB::Green: s::FillColor2 := s::FillColor . [0.0]: plot(s)
Using a utility function
randrange that returns
random ranges in [0, 1],
we can plot random rectangles with random colors:
randrange := () -> _range(op(sort([frandom(), frandom()]))): plot(plot::Rectangle(randrange(), randrange(), LinesVisible = FALSE, Filled = TRUE, FillPattern = Solid, FillColor = [frandom(), frandom(), frandom()]) $k=1..20, AxesVisible = FALSE)