Saturday, October 9, 2010

Further thoughts on Color::Declarative

The basic object in Color::Declarative is, of course, the color:
color green
or
color (SVG) blue
There is also a dictionary object to create custom dictionaries:
color-dictionary my-palette
If we're not using a custom dictionary, then we use Color::Library for named dictionaries, and the default there is the SVG dictionary as a kind of general catchall.

We can also define a whole new custom color from scratch like this:
color my-green #00ff02
But we're not normally going to do this. Instead, normally we'll define a color by its function:
color button-color (SVG) green
Then we can use it elsewhere. And we can do that for a whole set of colors like this:
color-dictionary my-palette
button (SVG) green
titlebar (SVG) blue
Then we can define a button something like this:
button fahrenheit (x=130, y=50, color=button) "Fahrenheit"
We could also imagine a palette defined something like:
color-dictionary
primary (SVG) { $retrieved_value }
secondary (SVG) primary.complement
I don't like that poorly considered syntax, but the point is that we should be able to build sophisticated palettes based on functional relationships.

No comments:

Post a Comment