Format spec · v1

The StitchingLab Pattern Notation

A canonical, lossless, human-readable text representation of a stitch pattern. The chess-FEN of crochet, cross-stitch, and knit colorwork.

Why a notation

Every pattern in the StitchingLab catalog has a single canonical text form — the SLPN string. Anyone with the SLPN can reconstruct the pattern exactly: the grid, the palette, the optional yarn assignments. Anyone with the pattern can serialize back to the same string. Round-trip identity is enforced by property-based tests.

That property is what makes SLPN useful beyond StitchingLab. The format is small enough to fit in a tweet, an SMS, an email signature, a QR code, a yarn label. Third-party tools — offline knitting apps, AR pattern viewers, e-readers, smart hooks — can integrate by parsing it. Patterns become portable.

Syntax (v1)

SLPN/<version>/<stitch_type>/<dimensions>/<palette>/<grid>/<yarn_map>?/<meta>?

A concrete 4×4 tapestry pattern with three colors:

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

Fields

Grid encoding modes

The grid is emitted in one of three modes, chosen by size:

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:

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 of the format will likely add:

v1 doesn’t preclude any of these. We will preserve forward and backward parsing in all subsequent versions.

Reference implementation

The reference TypeScript implementation lives at github.com/stitchinglab/stitchinglab in src/lib/slpn/. Property-based tests verify lossless round-trip on 1,000+ random patterns.

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.