Functions, the shape a colour follows
What a function says a colour does, in each of its four kinds: a spectrum read off a table of values, a ramp cut into bands by a small calculation, an ink whose conversion recipe is a program printed under its swatches, and a table joined end to end between two ends.
A gradient, a spot ink, a correction curve: in each case one number goes in and several come out, and the file says how. There are four kinds of function in the format, and this page draws one panel for each, with the program printed under what it draws.
A spectrum read off a table of values, a stepped ramp worked out by a small program, an ink whose conversion recipe is a program of its own, and a table joined end to end between two ends. Anything else on this site that involves a gradient or a separated ink is built on one of these four.
What this example shows
- The four kinds: from a table of values, from a curve, by joining, and by a small PostScript program.
- Each function's program printed under the panel it draws.
- The building block gradients and spot inks are made of.
The code, in full
The same document is written twice, once in each language. Both files are shown in full, with the code coloured on the server, and can be copied in one click.
The document itself
The same document is written in each of these languages. Open the one you want to look at.
Open the document in English
Open the document in French
Read the Rust source
Read the Python source