The new version is considered experimental and is put along-side version 1.1. The reason behind this is that we are not sure that the color manipulation model is right. Not that there are bugs (never!), but that the whole way of handling color may need rework. Be warned, scripts written for the experimental builds might be broken by changes made to the color model.
The documentation for color is pretty sketchy. Its just this post and what can be gleaned from welcome.cfdg and rose.cfdg. Sorry. Improved documentation is probably the next important thing to do for Context Free/CFDG.
The color model is the hue-saturation-brightness-alpha color space. In addition to the existing brightness adjustment we have added hue(h), saturation(sat), and alpha(a) adjustments. Saturation and alpha work just like brightness. Hue is like a rotation: 0 is red, 120 is green, and 240 is blue. So 'sat 0.5' moved the saturation 50% closer to 1 while 'hue 5' simply adds 5 to the hue value.
You can also set color values absolutely. For example, 'hue =180' sets the hue to cyan, and 'b =0.75' sets the brightness to 75%. Here is an example:
Code: Select all
// We have to declare the color parameter in the startshape
// or else a grayscale canvas will be created.
startshape GarishRainbow {color}
rule rainbow {
// this draws the actual bow, as a full circle
CIRCLE { }
// this chops off the bottom half to make the "bow"
SQUARE {sat =0 y -0.5}
// rotate the color and fade to white
rainbow {s 0.99 hue 10 sat -0.04}
}
rule GarishRainbow {
rainbow { b 1 sat 1 }
}