The pattern code

Your whole pattern, in one line of text.

Every StitchingLab pattern comes with a code — the SLPN. It looks like gibberish, but that one line is your entire chart: every stitch, every color, every yarn. Here’s what it means and why you’ll be glad it exists.

Why you’d ever care about a code

  • It’s a backup that can’t die. Paste it in your notes app, a text to yourself, or your Ravelry project page. As long as that line of text exists, your pattern exists.
  • It restores anywhere. Paste it into the converter on any device — phone, library computer, a friend’s laptop — and the full chart, written instructions, and row tracker come back instantly. No account, no file.
  • It’s how you share. Send the code to a friend and they have the exact same pattern — identical stitch for stitch, with your yarn choices attached.

Reading one, piece by piece

Take a tiny 4×4 practice pattern. Its full code is:

SLPN/1/T/4x4/3:F5E6D3,A8755C,3D3935/AAABABCBABCBCABA/LB-VC-CR:0,LB-VC-BR:1,LB-VC-CL:2/t=Wildflower-Square

Split at every /, it’s seven pieces, each with one job:

  1. SLPN/1

    The handshake

    Says "this is a StitchingLab pattern, version 1" — so any tool knows how to read the rest.

  2. T

    Stitch type

    T = tapestry crochet. F is filet, X is cross-stitch, K is knitting.

  3. 4x4

    Chart size

    Width × height in stitches. Your real patterns are more like 120x80.

  4. 3:F5E6D3,A8755C,3D3935

    The colors

    How many colors, then each one as a hex color code — cream, brown, near-black here.

  5. AAABABCBABCBCABA

    Every single stitch

    The whole chart, cell by cell: A = 1st color, B = 2nd, C = 3rd. Sixteen letters = sixteen stitches. Big charts use a compressed form instead.

  6. LB-VC-CR:0,…

    The yarns (optional)

    Which real yarn each color maps to — LB-VC-CR is Lion Brand · Vanna’s Choice · Cream.

  7. t=Wildflower-Square

    The title (optional)

    Your pattern’s name rides along too.

Got a code? Paste it in and watch it become a chart again.

Restore a pattern →

For tool builders · the formal spec, v1

Design goals

SLPN (StitchingLab Pattern Notation) is a canonical, lossless, human-readable text representation of a stitch pattern — the chess FEN of colorwork. Anyone with the SLPN can reconstruct the pattern exactly; anyone with the pattern serializes back to the identical string. Round-trip identity is enforced by property-based tests. The format fits in a tweet, a QR code, a yarn label; third-party tools integrate by parsing it.

Grammar

SLPN/<version>/<stitch_type>/<dimensions>/<palette>/<grid>/<yarn_map>?/<meta>?
  • SLPN/1/ — magic prefix and format version. Always literally SLPN.
  • stitch_type — one of T (tapestry), F (filet), X (cross-stitch), K (knit colorwork).
  • dimensionsWxH integers. 80x80, 4x4, etc.
  • paletten:hex,hex,.... Count, then comma-separated 6-char hex (uppercase, no #).
  • grid — encoded cells. See encoding modes below.
  • yarn_map (optional) — code:idx,code:idx,... mapping yarn merchant codes to palette indices.
  • meta (optional) — k=v;k=v;... with restricted charsets.

Grid encoding modes

  • ASCII (no marker, or A:) — for grids with ≤256 cells and ≤26 colors. Each character A..Z is a palette index. Easy to read, easy to parse.
  • Packed base64 (B:) — each cell is N bits big-endian, packed sequentially. Bit width: 1 (≤2 colors), 2 (≤4), 4 (≤16), 5 (≤32), 6 (≤64), 7 (≤128), 8 (≤256). Per spec, palettes ≤8 colors use 4 bits for byte alignment. URL-safe base64.
  • Gzip + base64 (Z:) — for very large grids (over 200×200 cells or over 32 colors). Bits packed → gzipped → URL-safe base64 encoded.

Yarn map

Each entry is <merchant>-<line>-<color>:<palette_index>. Example: LB-VC-CR:0 = Lion Brand, Vanna’s Choice, Cream → palette index 0. The merchant codes are stable identifiers maintained in our yarn database’s code column.

Meta

Optional key/value pairs. Keys match [a-z][a-z0-9]*; values match [A-Za-z0-9_.\-]+. Spaces are not allowed in values (use _). Reserved keys: t — pattern title; a — attribution.

Versioning and compatibility

Breaking changes increment the version number. Parsers must support all previous versions for indefinite backward compatibility. Chess FEN is 30+ years old; SLPN should aspire to similar longevity.

v2 will likely add:

  • Stitch-instruction layer — written patterns (rows of sc, dc, ch, sl st with shaping).
  • Repeat markers — for parametric patterns.
  • Construction graph — for non-grid 3D patterns (amigurumi).

Plaintext API

Any public pattern can be fetched as plaintext SLPN at GET /api/p/<content_hash> with Content-Type: text/plain. This is the integration entry point for third-party tools.