The first libraries
A language on its own is not much to draw with. What makes a tool feel rich is its vocabulary: a brush, a noise field, a way to mix paint. In most tools that vocabulary is a big block of code that ships with every piece, whether the piece uses it or not.
In Nilo the libraries are written in Nilo. The compiler reads them when it builds a piece, takes the functions the piece calls, and leaves the rest behind. So I can have a large vocabulary and still ship a small file.
There are three so far: noise, colour, and one brush. Using them is one line at the top of a piece:
use noise v1, colour v1, brush v1Currents
To test them I had a new piece written. Not a copy of anything. Brush sweeps follow a slow flow across the sheet and take their paint from one ramp of four colours.



It is a test of the brush, not a finished work. The strokes are spread too evenly and there is no composition. But the brush has body, the streaks read as bristles, and the ends taper the way a lifted brush does.
What ships
| Part | Bytes |
|---|---|
| The piece’s own code | 1,679 |
| brush | 2,057 |
| colour | 717 |
| noise | 457 |
| Compiler helpers | 539 |
| Total | 5,449 |
Only what the piece calls is in the file. To be sure of that, a second piece was built that names all three libraries and calls a single colour function. It came out at 681 bytes, the same as if that one function had been typed into the piece by hand.
The whole piece
This is all of it. Thirty-five lines of code.
// currents: brush sweeps laid along a slow noise flow, painted from one ramp
plate(1920, 2400)
use noise v1, colour v1, brush v1
random layout, paint, marks
// four ramps, dark to pale; the token takes one
let ramps = [#1d2b3a, #3e5c76, #9fb4c7, #ece6d8, #3b1f1a, #8c3b24, #d98e4a, #f2dfc2,
#1f2a1d, #4f6b3a, #a9b98a, #ece8d6, #2a1f33, #6b3f6e, #c98fae, #f3e3ea]
let pick = paint.int(0 ..< 4) * 4
let ramp = [ramps[pick], ramps[pick + 1], ramps[pick + 2], ramps[pick + 3]]
let paper = colour.mix(ramp[3], #fbf8f1, 0.6)
// the flow: a turn of the whole plate, bent by layered noise
let field = noise.table(layout)
let scale = layout.float(0.0005 ..< 0.0011)
let turn = layout.float(0 ..< TAU)
let swirl = layout.float(1.5 ..< 3.5)
fn flow(p: vec) = turn + noise.octaves(field, p * scale, count: 3) * swirl
// a path from p along the flow in steps of 12, ending where it leaves the plate
fn follow(p: vec, steps: int): vec[] {
let path = vec[]
var q = p
for k in 0 ..< steps {
path.add(q)
q = q + polar(flow(q), 12)
if q.x < -60 || q.x > 1980 || q.y < -60 || q.y > 2460 { break }
}
return path
}
background(paper)
let count = layout.int(110 ..< 170)
for i in 0 ..< count {
let start = vec(layout.float(-60 ..< 1980), layout.float(-60 ..< 2460))
let path = follow(start, layout.int(24 ..< 70))
// broad sweeps first, finer ones over them
let width = (110 - 70 * i / count) * layout.float(0.7 ..< 1.3)
if path.len < 6 { continue }
// its value off a second, broader reading of the noise, its hue nudged
let v = 0.55 + noise.at(field, start * 0.0004 + vec(40, 0)) * 0.5
let hue = paint.float(-0.03 ..< 0.03)
let tone = [colour.shiftHue(colour.at(ramp, v - 0.25), hue), colour.at(ramp, v), colour.at(ramp, v + 0.15)]
brush.sweep(marks, path, width, tone, opacity: 0.8, body: 0.5)
}The line I care about most is the last one. brush.sweep is a whole painted stroke, made of dozens of fine
streaks, and in the piece it is one call. The 144 lines that make it work live in the library, where I can open
them and read them, and change them if I want a different brush.
What is missing
One brush is not a vocabulary. There are no gradients, no curves, no way to group things and turn them. Each of those is a library still to be written, and until they are, most of what I would reach for in a real piece is not there.