Graphics library
Graphics library
Maintainer notes for the graphics library: how it is built, the elements.json fields and how to add an element. To use the graphics, start at graphics.md: the rules, and a card per set leading to its gallery (/graphics/<set> on the site), which lists every file.
One folder per set, grouped into families by FAMILIES in system/build/build-galleries.py. Each holds elements/ (the files), elements.json (the set and its elements, the source of its gallery), usually a README.md (where the sources are and how the files were made) and, once built, thumbs/ (600px previews, gitignored). sprite/ holds only elements.json: its symbols are in system/graphics.svg.
Build
python3 system/build/build-galleries.py
From sor-design-system. It writes graphics/<set>.md (one gallery page per set), the cards and the rules table in graphics.md (between the <!-- library:… --> markers) and logos.md, and makes the thumbnails (ImageMagick magick, or sips on macOS). The pages are Flowershow pages with layout: plain, so they keep the site navbar; their behaviour (ground and ink switchers, search, copy path) is library.js, loaded as a page script, and their look is library.css with the system tokens, inlined into each page and scoped to .sg. The frame of a gallery page is gallery-shell.html. Never edit the generated pages by hand.
elements.json
{
"title": "Animals",
"family": "woodcut",
"lede": "One paragraph: what the set is.",
"use_for": "One line: where it goes.",
"colour_rule": "Which colours it may be used in.",
"grounds": ["white", "paper", "sunlight"],
"registers": ["Conversation", "Gathering"],
"formats": "SVG and PNG",
"rights": "not-cleared",
"notes": "Optional: one more rule for this set.",
"render": "img",
"cover": ["fox-sitting-linocut", "swan-wings-open-linocut"],
"elements": [
{
"slug": "fox-sitting-linocut",
"title": "Fox sitting",
"kind": "linocut",
"desc": "One or two sentences.",
"source": "Mood board 01",
"rights": "draft",
"versions": [
{"ink": "black", "name": "Black", "hex": "#1b1916"},
{"ink": "colour", "name": "Original colours", "hex": null, "note": "watercolour", "file": "fox-sitting-linocut-colour"}
]
}
]
}
- Set.
familyis one ofwoodcut,painted,line,landscape(the groups on the hub).groundsare the grounds the set may sit on, fromwhite,paper,sunlight,night; the gallery offers only those.registersare from Study, Conversation, Gathering (feel.md).rightsisoursornot-cleared.renderisimg(thumbnails of PNGs, the default),inline(the SVG inlined so it takes the ink of its ground) orsymbol(a sprite symbol).coverpicks up to six elements for the hub card; without it, the first six. - Element.
rightsonly when it differs from the set (draft: redraw or re-source before public use); the gallery tags it.wide: truegives the plate two columns. - Version. One per colour. The file stem is
file, or<slug>-<ink>without it; the builder links the.pngand.svgit finds inelements/.hexis the ink colour (#1b1916 + #e5201cfor two), ornullwith anote.
Add an element
- Put the files in the set's
elements/: a transparent PNG, 1000px on the long side, and an SVG where it is small and clean. - Add it to the set's
elements.json, in the file's own indentation. - Run
python3 system/build/build-galleries.pyand check the gallery page.
A sprite symbol: draw it in system/graphics.svg, run python3 system/build/build-graphics.py, then add it to sprite/elements.json.
A new set: a new folder with the same parts, then add it to FAMILIES in system/build/build-galleries.py.