How to create consistent illustrations with AI: put the style in code

To create consistent illustrations with AI, write the style down as rules the generator cannot ignore, then make every illustration through those rules. With image models that means a fixed prompt template, style reference images or a trained style, which reduce drift but never remove it, because each image is still a fresh sample. For product illustrations made of objects, the most reliable method is to put the style in code: an agent draws every figure through the same camera, line width, palette and motion rules, so the set is consistent by construction.

Why every generation drifts

An image model samples a new picture each time. Your prompt fixes the subject and a style word or two, and leaves the rest open: the angle, the stroke weight, the detail, the light. Each run settles those differently. Put ten images side by side and the set looks like it came from ten people.

Style words do not pin much down: "flat line illustration, minimal, brand blue" describes thousands of looks. A reference image carries more, but it transfers a mood, not measurements. The model does not know the lines were meant to be 1 px, or that every object sits at the same angle.

People work around this by hand. One Hacker News poster describes generating images with ChatGPT, a prompt to keep the style consistent, and cleaning them up in GIMP afterwards. That works, and it costs time on every image.

The approaches people use

Prompt templates

Keep one long prompt with the style written out (medium, palette, line, composition) and change only the subject. Cheap and works with any model. It narrows the drift without stopping it.

Style references

Give the model images to copy the look from. Midjourney's style reference (--sref) takes image URLs or a style code and applies that look to new prompts. Recraft lets you build a custom style from a few approved images and generate sets from it. Much closer than words alone, and still a sample each time.

Trained styles and fixed seeds

A LoRA is a small add-on trained on your own images so an open model like Stable Diffusion learns the style (Hugging Face's guide). It holds a style better than a reference, but it needs a set of good images to train on, and a GPU. Fixing the seed makes a run repeatable; it does not make a different subject come out in the same style.

A design system in code

Draw the illustrations as code (SVG, canvas or three.js) and write the style as rules: this camera, this line width, these colours, these timings. An agent writes each new figure and shared code renders it, so the style is applied, not described.

The trade-offs

ApproachConsistencyGood forCosts
Prompt templateLoose: same mood, different detailsQuick sets, any subjectDrift, manual clean-up
Style reference (--sref, custom styles)Close in look, varies in angle and detailPainterly or brand imageryStill sampled; a picture, not editable parts
LoRA, fixed seedStrong for the trained lookCharacters, a signature styleTraining images, a GPU, upkeep
Style in codeExact for what the rules coverObjects, icons, diagrams, product momentsOne look; no people, texture or paint

For characters or painted scenes, an image model with a trained style is the tool. For many small objects across empty states, loaders and feature sections that must sit together on one site, code wins.

The argument for putting the style in code

A rule written as a number does not drift. "Lines are about 1 px on screen at any size" is either true of a drawing or it is not, and a renderer can make it true every time. The categories that make a set feel like one hand are all things code can fix:

  • Camera. One projection and one angle, so every object is seen the same way.
  • Line. One weight, and a rule for when to use fewer lines.
  • Palette. A small set of named tones, each with one job.
  • Detail. A limit on how many parts, and what counts as too small.
  • Motion. A fixed list of timings and easings, and what kind of move is allowed.

A 3D model helps further. An Ask HN thread on simple illustrations makes the point that starting from a 3D model lets you rotate one object and get every angle of the same thing. In three.js the object is the illustration, so the angle is just a setting.

Code also makes a set editable. Changing the brand colour across every figure is one value, not a regeneration of every image.

Linejig's rules as a worked example

Linejig is a library of interactive 3D line illustrations built this way, with a free Line art skill, tested in Claude Code and Codex CLI, that draws new figures to the same rules. The line rules build on Hairline by Lucas Marques (MIT). These are the actual rules the skill and the engine use:

  • Camera: orthographic, 2:1 axonometric (azimuth 45°, sine of elevation 0.5). The object is centred and fills about 60 to 75% of a 5:4 plate.
  • Construction: a handful of rounded solids, usually 8 to 12, each drawn as its silhouette plus one crease ring inside its top edge. Fine marks such as ticks and seams are single dim lines. No rivets, hatching, texture, shading or gradients.
  • Line: one width, about 1 px on screen at every size and zoom. Where the drawing gets dense, one line replaces two; a second line, if truly needed, is about 0.5 px and dim.
  • Palette: five tones (plate, edge, mid, lo and hi) on a white plate in light mode and a near-black plate in dark. Hierarchy comes from tone only, never from thicker lines. Exactly one part gets the bright hi tone. The Brand style, where that part takes your brand colour, and the Dots style come in the Pro skill, Linejig Pro.
  • Concept: one object that says the message without a caption, and one hero part that carries it. The skill writes three concepts and waits for you to pick before drawing. No text inside the drawing.
  • Motion: a 700 ms tween on cubic-bezier(.32,.72,0,1) for discrete moves, a spring (k 100, c 18) for parts that should settle, draw-on in about 1250 ms. One move that does what the real part does. With reduced motion, the final state at once.

Rules in a document are still advice. What makes them hold is that the shared engine owns them: the camera, palette, line widths, intros, orbit and zoom live in one kernel, and a figure file holds only its model, the order its parts assemble in, and what its hero does. A new figure cannot pick a different line width, because it never sets one. The skill then renders frames at the start, middle and end of the move, in both themes, at desktop and phone width, and checks the tone ramp on real pixels before showing anything.

These were drawn separately, for different moments, and sit together because none of them made its own decisions about the look. The limits: it is one look, it draws objects rather than people, animals or scenes, and it needs three.js on the page. If that look is wrong for your brand, take the method, not the style: write your own rules into a shared renderer.

A practical checklist

  1. Write the style as measurable rules: camera, line weight, palette with a job for each tone, level of detail, motion timings.
  2. Name what is banned: text in drawings, gradients, extra line weights, whatever keeps creeping in.
  3. Decide the concept rule: one object, one message, no caption needed.
  4. Put the rules where the generator must use them: a shared renderer for code, a fixed template and reference set for image models.
  5. Keep the per-illustration part small: only the subject changes.
  6. Render every new illustration next to three existing ones before accepting it.
  7. Check both themes and phone size, not just the desktop view.
  8. When a rule fails, change the rule, then redraw, rather than fixing one image by hand.

Next step

See the rules applied across the library, or try the free Line art skill in Claude Code or Codex CLI on one screen of your own. The free figures embed with no account.

Published 21 November 2026.

Figures in this guide