Text and shapes filled with a gradient

A headline in a blend of colours belongs to a poster, a cover, a title page — and the usual way to get one is to build it in a drawing program and drop the picture in. The text then stops being text: it cannot be searched, it cannot be copied, and it cannot be translated without going back to whoever made it.

Here the letters stay letters: they can be searched, copied and translated, and the blend shows through them all the same. The gradient is pinned to the page, and each letter is a window onto the part of it lying behind. That is why the word reads as one sweep from end to end instead of the same little sweep repeated inside every letter — which is what a drawing program gives you, and what makes a headline look cheap. A shape is served the same way: the panel below is filled with a circular blend, and it is still a shape, not a picture of one.

What this example shows

  • A gradient used as a fill colour rather than painted directly.
  • Text whose glyphs show the gradient behind them.
  • The gradient pinned to the page, so it spans the whole word.

The source code, complete

Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library. The third is the description itself: a plain list of what the page has to say, which is what the service is sent.

Read the Rust source Read the Python source Read the JSON source

The document itself

Open the document in English Open the document in French

Text and shapes filled with a gradient, first page

Optimised, this document weighs 10.6 kB — at least 90 % lighter than most PDF generators would write it

The document is lighter than it was, and every page still looks exactly the same. See this document's row in the table of every example.

Examples near this one

Cutting out what you draw

The same area of stripes shown through two windows: a plain disc, and a ring whose middle is left bare.

Transparency and blend modes

Half-transparent fills that overlap and mix, one orange square laid over a blue bar in four different ways of mixing colours, and a line of overlapping letters painted two ways.

Gradients in a line, in a circle, and read from a function

Five panels: a header that fades out, the same fade on the diagonal, a glow carried past its own circle so the corners fill, a blend that goes by way of a third colour, and a checkerboard whose colour is worked out from where each point stands, redder to the right and greener towards the top.

Four kinds of mesh, every corner its own colour

Six triangles round a centre they share, their edges stroked over the paint; a lattice of points in the four printing inks; a patch whose four sides are curves; and the same patch pulled about by four points inside it.

Every example, by subject