Multi-color Modular Truchet

First appeared 1704 · Sébastien Truchet — Generalization of Truchet tiles (Sébastien Truchet, 1704; multi-tile sets popularized by Cyril Stanley Smith, 1987). · timeline ↗

community / folk Name — Descriptive variant name in the Truchet-tile family (Truchet, 1704); a compound descriptive label, not a separate eponym.

In one line A multi-template Truchet tiling: a small set of square, triangle and quarter- circle motifs, each placed in 4 rotations and several variants, filled with flat multi-colour palettes for a Bauhaus / mid-century look (e.g. Harvey Rayner / patterndotco).

Multi-color Modular Truchet · Open in new tab ↗ · Motion begins only when you press Run.

The code

The actual sketch behind the demo above — sandboxed and reproducible. This is the whole thing.

truchet-multitile/index.html
const SEED = Math.floor(Math.random()*1e9);

const PALETTES = [
  // Bauhaus / patterndotco-ish
  ['#fafaf2', '#1ecbb0', '#e8253a', '#0d1b2a'],
  // Mid-century warm
  ['#f5e9d3', '#e8a87c', '#c38d9e', '#41b3a3'],
  // Memphis bright
  ['#fdfcdc', '#ffd166', '#ef476f', '#073b4c'],
  // Bauhaus primaries
  ['#f4f1de', '#e07a5f', '#3d405b', '#81b29a'],
  // Mono navy + crimson
  ['#f5f1e6', '#d62828', '#003049', '#fcbf49'],
];

function setup() {
  randomSeed(SEED);
  const s = Math.min(windowWidth, windowHeight);
  createCanvas(s, s);
  noStroke();

  const palette = PALETTES[Math.floor(random(PALETTES.length))];
  background(palette[0]);

  // Each cell: pick (bg, fg) from palette, then a tile template + rotation.
  // 7 templates × 4 rotations = 28 distinct visible tiles.
  const N = 12;
  const cs = width / N;

  for (let i = 0; i < N; i++) {
    for (let j = 0; j < N; j++) {
      const x = i * cs;
      const y = j * cs;

      // Pick two distinct colors. p5's shuffle() returns a new shuffled
      // array by default — capture the return value.
      const cs2 = shuffle(palette);
      const bg = cs2[0];
      const fg = cs2[1];

      // Background square
      fill(bg);
      rect(x, y, cs, cs);

      // Foreground tile template (1..6; 0 means "no overlay")
      const t = Math.floor(random(7));
      if (t === 0) continue;
      const rot = Math.floor(random(4));

      fill(fg);
      push();
      translate(x + cs / 2, y + cs / 2);
      rotate(rot * HALF_PI);
      translate(-cs / 2, -cs / 2);

      switch (t) {
        case 1: {
          // Quarter disc filling top-left 3/4 corner (arc, center at top-left)
          arc(0, 0, cs * 2, cs * 2, 0, HALF_PI);
          break;
        }
        case 2: {
          // Diagonal half (top-left triangle)
          triangle(0, 0, cs, 0, 0, cs);
          break;
        }
        case 3: {
          // Two opposite quarter discs (top-left + bottom-right corners)
          arc(0, 0, cs * 2, cs * 2, 0, HALF_PI);
          arc(cs, cs, cs * 2, cs * 2, PI, PI + HALF_PI);
          break;
        }
        case 4: {
          // Half rectangle (top half)
          rect(0, 0, cs, cs / 2);
          break;
        }
        case 5: {
          // Small quarter disc in the top-right corner (1/2 size)
          arc(cs, 0, cs, cs, HALF_PI, PI);
          break;
        }
        case 6: {
          // Eye shape: two big quarter arcs from top-right + bottom-left
          arc(cs, 0, cs * 2, cs * 2, HALF_PI, PI);
          arc(0, cs, cs * 2, cs * 2, -HALF_PI, 0);
          break;
        }
      }
      pop();
    }
  }
}

Open the demo source ↗

How it works

Extend basic Truchet (one tile, random orientation) to a richer set: 1. Define a small library of tile templates whose motifs meet the cell edges at the same connection points (corner-to-corner triangles, quarter-circle arcs joining edge midpoints) so any tiles abut cleanly. 2. For each grid cell, choose a template and one of its 4 rotations (and reflections), often weighted, sometimes constrained so neighbours connect. 3. Assign flat colours per region from a small palette — foreground/background can swap per tile, multiplying the visual variety. Because all variants share edge connection points, the local choices assemble into continuous interlocking curves, ribbons and chequer motifs.

Parameters

Lineage

Related
Truchet Tiles, Geometric / Hexagonal Tiling, Wave Function Collapse

Frequently combined with

Works using this algorithm (7)

70s Pop Ghost Bonus Pack 👻
daniel-catt
70s Pop Series One
daniel-catt
Divisions
michael-connolly
Machine Comics
roni-block
Placement
cooper-jamieson
Squares
martin-grasser
Trossets
anna-carreras

Last updated 2026-07-16