Originally, CF didn't have color. Things were much simpler, rendered faster, and you didn't have to worry about clashing colors. So far, the color transition has been pretty nice though. The new color system is kind of confusing, espescially compared to the simplicity of the rest of the language. Part of this may be due to the lack of documentation, which thankfully I am here to help with.
The color modifiers bring in some new fun. CF uses the HSB/HSV color mode. Hue is the color, defined by a number between 0 and 360 indecating its location on a color wheel. Saturation is how much of the color there is washed in with the gray. Brightness is how bright it is. 0 saturation mixed with 50% brightness gives us a 50% gray. 100% brightness is white and 0% is black, regardless of hue and and saturation. Context-Free also gives us an alpha option, for transparency.
Since many of us aren't used to using HSB color, the windows and mac versions give us a color wheel. Some basic colors though are:
- Pure red at 360 or 0 degrees
- Green at 120 degrees
- Yellow at about 60 degrees
- Blue at 240 degrees
- Purple at 300 degrees
Please note that many of this will be borrowed heavily from the info on this page.
Using color in CF can either be really easy or really difficult. If you want to keep the hue within a specific range, controlling it can be difficult. This can be espescially true if the hue varies due to use of different hue adjustments in random rules (when 2 or more rules share a name). The easiest way to control it, in my opinion, is to make sure that even if the majority of the time the hue is moving one way, the drawing terminates before it gets out of your range. You can do this by having a "stop rule", a rule that is rarely called, and doesn't do anything, thus ending that branch of the program. The other option is to make the shape size too small before it gets to a hue value you don't want.
If, however, you dont care about hue ranges, then all is well, and life is easy for you.
Hue is the same as rotation, you can add or subtract from it each time you call a rule, and going past 360 or 0 in either direction just loops back over. Saturation brightness, and hue got a new concept with the addition of color, involving moving towards or away from limits. It uses the "pipe", a key well known to *nix system users, as well as programmers. It is below the backspace key, you need to hit shift backspace to get it. It looks like this: '|'. Find it? Good. shit i need someone else to write this because i dont understand color. email me at matt d0t pace att gmail d0t c0m. zeroes and stuff to prevent spam bots from getting me. thanks!
home | Tutorial 4