Skip to content
Xerobi Icons

Adding an icon

From idea to merged pull request: search, name, scaffold, draw, check all six weights, and submit.

Last updated

This is the whole path from idea to merged pull request. The why is in the design principles and design language. The rules are in the design specification, and the machine-checked ones are listed in the lint rules.

0. One-time setup

uv sync --project tooling/generator     # Python 3.12 and the build dependencies
bun install

Everything below is run from tooling/generator/ (or prefix the script path). uv run scripts/icon.py --help lists the tools.

1. Decide that it should exist

uv run scripts/icon.py search envelope mail     # names, tags and retired names, best match first
  • If an icon already shows the concept, use it; if people look for it under another word, add that word to the existing icon’s data-tags. Do not draw a second copy. The lint fails on a duplicate drawing.
  • Write the concept in one sentence (“an open padlock: access is allowed”). If you cannot, the icon is not ready.
  • Check the metaphor is not already taken by something else, and is not culture-specific (XIDS-DP 4, 14).

2. Name it

Rules (lint name): lowercase ASCII words joined by hyphens, at most 40 characters, describing the concept, not the drawing.

  • Follow the neighbours: arrow-left, cloud-arrow-up, folder-open, file-pdf, wifi-high. icon.py search shows the pattern.
  • Never put a weight in the name (house-fill, house-bold). Weights are the package’s job.
  • Singular for things (user), plural only when it is a different concept (users).
  • A variant is <base>-<modifier>: file-plus, bell-slash (see step 5).

3. Scaffold it

uv run scripts/icon.py new lock-open-heart -c Security -t privacy,favourite,safe,unlock --from lock-open
  • -c is one of the 31 categories (the command lists them if you get it wrong); -t is at least 3 comma-separated search terms: synonyms people would type, lowercase, no more than 12.
  • --from <icon> starts from a copy of a similar icon, which is the fastest way to inherit the right proportions. Without it you get a placeholder circle, which fails the duplicate check until you replace it.
  • The command refuses if similar icons exist (so you look at them first); --force overrides after you have.

4. Draw it

Open icons/<name>.svg in a text editor (and a browser tab for live preview), or draw in Figma/Illustrator on a 256 × 256 board and paste the shapes in.

The rules in one screen:

Grid 256 × 256. Keep geometry inside 32–224.
Stroke 16 units, round caps and joins, set on the group, never on a shape
Coordinates whole numbers for line ends, circle centres, rect corners (multiples of 4 are best)
Curves arcs and cubics with anchors at the top, bottom, left and right extremes. No sampled polylines
Size a container (card, circle) keeps to its keyline: circle 192, square 176, other rectangle 192 on the long side; open shapes use the full live area
Detail at most 8 stroked shapes; at least 24 units between parallel strokes
Corners rx 16 on large containers, 8 on small parts

Every shape goes in a role group. The role decides what the shape becomes in each weight:

Role Outline weights (thin to bold) Fill Duotone
line stroked merged into the solid stroked
detail stroked cut out of the solid stroked
area not drawn the solid body 20 % tint
hole not drawn cut out not drawn
dot / dotcut solid dot merged / cut out solid dot

How to think about it: draw the outline with line and detail; then put the closed silhouette in area (this is what makes the fill weight solid and the duotone tinted); use hole for openings that must stay open when filled (a door); use detail for lines that should show as a cut-out in the solid (the shackle gap, a window frame). Worked example, house:

<g data-role="area" fill="currentColor" opacity="0.2"><path d="M48 112 L128 44 L208 112 V208 H48 Z"/></g>   <!-- the body -->
<g data-role="hole" fill="none"><path d="M116 208 V164 A12 12 0 0 1 140 164 V208 Z"/></g>                       <!-- the door stays open when filled -->
<g data-role="line" ...16-unit stroke...> walls, roof, door outline </g>

Letters, numbers and symbols where filling would close the counters stay outlined in every weight: add data-fill="outline" on the <svg>. Carets and small marks that are meant to be small: data-size="symbol". More than 8 strokes that still read at 16 px (dashed lines, grids): data-detail="reviewed", only after you looked.

People, text and arrows have their own conventions: the design specification (text in icons, people), and copy person, user, arrow-right.

5. Variants

  • Slash (<base>-slash): the base icon, unchanged, plus one slash group with M48 48 L208 208. Do not trim the base by hand; the build cuts the gap. After changing a base icon, run uv run scripts/batches/194_slash.py.
  • Badge (<base>-plus, -minus, -x, -check, -warning, -question, -heart, -star, -gear, -magnifying-glass, -arrow-up, -arrow-down, -user): the base plus the standard badge. uv run scripts/batches/200_badges.py rebuilds them all. If the modifier is drawn into the icon instead, mark it data-badge="custom".

6. Check it

uv run scripts/icon.py check lock-open-heart     # lint rules + the consistency audit for just this icon
uv run scripts/icon.py weights lock-open-heart   # writes build/weights.svg: open it in a browser

Fix everything check prints; each message names the rule (the rule list is RULES in scripts/lint.py).

Then look at the sheet; no tool replaces this. For each of the six weights:

  1. Read the 16 px and 12 px rows first. If you cannot tell what it is, remove detail.
  2. Thin, light, regular and bold must be the same shape. In bold, gaps between parallel strokes must still be open.
  3. Fill must be solid where it should be and open where it should be. If it looks like regular, you are missing an area.
  4. Duotone needs a visible tint behind the lines. No tint means no area.
  5. Compare against house, gear and envelope (always at the top of the sheet) for size, weight and centring, on the dark panel too.
  6. The dashed box on the 48 px copy is the live area: art touching or crossing it is too big.

Problem in one weight? Fixing a weight.

7. See it in the product

bun run build:data           # outlines every icon into build/icons.json (about a minute)
bun run dev                  # the website; your icon is at /icon/<name>/ and in /icons/

8. Open the pull request

Commit only tooling/generator/icons/<name>.svg (and aliases.json / duplicates-baseline.json if a decision needed them). Do not commit packages/, svg/ or build/: maintainers regenerate those in the release pull request, which keeps icon pull requests small and conflict-free.

uv run scripts/icon.py review lock-open-heart    # prints a filled-in checklist: paste it into the pull request

Pull request title: Add <name> icon. Add a screenshot of the weights sheet. Record any deviation from the rules in the PR (icon, issue, decision, reason), following XIDS-DP 16.

What a reviewer does

Runs icon.py check and icon.py weights, then reads the checklist: meaning, weights at small sizes, optical balance, naming, tags. Outcomes are approved, approved with a recorded exception, changes requested, or rejected (XIDS-RC 12).

Quick reference

uv run scripts/icon.py search <words>        # find before you draw
uv run scripts/icon.py new <name> -c C -t a,b,c [--from base]
uv run scripts/icon.py check [names]
uv run scripts/icon.py weights <names>
uv run scripts/icon.py review <name>
uv run scripts/lint.py                       # everything, as CI runs it
uv run scripts/audit.py --check              # consistency across the set, as CI runs it