General Issues
|
6.3: ColorBesides color images, Gri permits the use of arbitrary grayscale or color in any drawn item.
The darkness of the ``pen'' used in drawing commands (for either lines or
for text) is set by ` The graylevel applies to text as well as lines. Often you'll want to draw a gray line and a black label beside it, or you'll want to set a graylevel temporarily. Here's how to do it:
The color of the "pen" may be set to any value you can describe with an RGB (red, green, blue) or HSB (hue, saturation, brightness) specification, or a color name. This pen color applies to everything, even text.
6.3.2.1: The `
Set the pen color to the indicated name. By default, only a handful of
colors are known. You MUST give color names as written here,
obeying the capitilization shown. The color mixes are identical to
those used in X11. The following lists some of the colors Gri knows by
default.
|
NAME RED GREEN BLUE "white" 1.000 1.000 1.000 "LightGray" 0.827 0.827 0.827 "darkslategray" 0.184 0.310 0.310 "black" 0.000 0.000 0.000 "red" 1.000 0.000 0.000 "brown" 0.647 0.165 0.165 "tan" 0.824 0.706 0.549 "orange" 1.000 0.647 0.000 "yellow" 1.000 1.000 0.000 "green" 0.000 1.000 0.000 "ForestGreen" 0.133 0.545 0.133 "cyan" 0.000 1.000 1.000 "blue" 0.000 0.000 1.000 "skyblue" 0.529 0.808 0.922 "magenta" 1.000 0.000 1.000 |
To get more colors than this, use the `read colornames
' command.
You should do a test case for your printer to see which colors you find
most to your liking. You'll want to pick colors that look different
from each other. In some cases you might want to avoid dithered colors,
since they look too broken on really thin lines. For example, on my
printer I like the following colors: `black
', `red
',
`yellow
', `green
', `cyan
', and `magenta
'.
set color rgb .red. .green. .blue.
' Commandset color hsb ...
' style described below.
The the individual color components as follows. The numbers
`.red.
', `.green.
' and `.blue.
' range from 0 (for no
contribution of that color component to the final color) to 1 (for
maximal contribution). Values less than 0 are clipped to 0; values
greater than 1 are clipped to 1. EXAMPLES:
set color rgb 0 0 0 # black set color rgb 1 1 1 # white set color rgb 1 0 0 # bright red set color rgb 0.5 0 0 # dark red set color rgb 0 1 0 # pure green set color rgb 1 1 0 # yellow: red + green |
set color hsb .hue. .saturation. .brightness.
' Commandrgb
' command.
The the individual color components as follows. The numbers
`.hue.
', `.saturation.
' and `.brightness.
' range from 0
to 1. The color, represented by `.hue.
', ranges from 0 for pure
red, through 1/3 for pure green, and 2/3 for pure blue, and back to 1
again for pure red. (HINT: It is a good idea to limit the total range
of hue you use to 2/3, instead of 1; otherwise you'll get confused by
(nearly) repeated colors at the crossover. For example, limit the hue
to range from 1/3 to 1, or 0 to 2/3.) The purity of the color,
represented by `.saturation.
', ranges from 0 (none of the hue is
visible) to 1 (the maximal amount is present). Less saturated colours
are like those you would get from mixing black paint into coloured
paint. The brightness of the color, represented by `.brightness.
',
ranges from 0 (black) to 1 (maximal brightness). Lowering brightness is
like decreasing the intensity of the light you shine on a painting.
Hue, saturation, and brightness values are all clipped to the range 0 to 1. EXAMPLES:
set color hsb 0 1 1 # pure, bright red set color hsb 0 1 0.5 # half black, half red set color hsb .333 1 1 # pure, bright green |
6.4: Interacting with the user
Use the `query
' command to interact with the user see Query. The
results can be stored in variables and synonyms.