Skip to content
Xerobi Icons

Fixing a weight

How to fix an icon that looks wrong in one weight: every weight comes from one drawing, so the fix is in the drawing or its roles.

Last updated

All six weights come from one source drawing. There is no per-weight override, on purpose: it is what keeps the weights the same icon. So “fixing a weight” always means fixing the drawing or its roles in icons/<name>.svg, and the build remakes every weight from it.

How each weight is made (scripts/build.py):

Weight Made from
thin 8, light 12, regular 16, bold 24 line + detail (+ slash, badge) stroked at that width, outlined to one flat path
fill area + line merged into a solid, then detail, hole, dotcut cut out
duotone area at 20 % opacity behind the line + detail strokes

The loop

cd tooling/generator
uv run scripts/icon.py weights <name>      # 1. reproduce it: build/weights.svg, all six weights, 12 to 48 px, light and dark
# edit icons/<name>.svg                    # 2. change the drawing or its roles
uv run scripts/icon.py check <name>        # 3. lint + audit
uv run scripts/icon.py weights <name>      # 4. look again. Repeat until all six rows are right
bun run build:data                         # 5. (optional) see it in the site: bun run dev

Symptom, cause, fix

You see Cause Fix
Fill looks like regular No closed solid: the icon has no area Add an area group with the closed silhouette. If it is an open shape (an arrow, a line) this is correct: nothing to fill
Fill is a blob, details vanished Inner strokes are in line, so they merge into the solid Move strokes that should read as cut-outs (window panes, the gap in a lock) to detail; add hole for openings
Fill hides an opening that matters (door, handle, slot) No hole Add a hole shape over it
Fill closes up letters, numbers, ♯ and similar The counters get filled Add data-fill="outline" on <svg>: the fill weight stays outlined, by decision
Duotone has no tint No area Add the area (the same silhouette as for fill)
Duotone tint covers a detail area is bigger than the object Trim the area; it should sit inside the strokes
Bold looks clogged, gaps closed Parallel strokes too close: bold is 24 wide Move the strokes apart (24+ between parallel strokes), drop one, or simplify the icon
Thin looks broken or wispy A very small detail that only a 16-wide stroke carries Enlarge or remove the detail
Bold or thin has a different shape from regular A shape that is not a stroke (an area with its own outline) Draw it as line so it scales with the weight
A curve is lumpy in bold Curve built from many tiny straight segments Redraw with arcs and cubics (lint tessellated); uv run scripts/batches/193_refit.py converts such paths
A stroke touches the edge, clipped Geometry outside the 32–224 live area Move it in (lint live-area); icon.py weights shows the live-area box
A -slash weight is wrong The slash cut is made by the build Never hand-trim the base. Fix the base, then uv run scripts/batches/194_slash.py
A -plus/-check/… badge weight is wrong Same: the badge clearing is made by the build Fix the base, then uv run scripts/batches/200_badges.py; or mark data-badge="custom" if drawn into the icon
It looks smaller or off-centre next to neighbours Size or centring uv run scripts/audit.py; scripts/batches/196_keylines.py and 235_consistency.py scale and centre

Finding what needs fixing

uv run scripts/weights.py --report            # counts: fill=regular, duotone=regular, clipped
uv run scripts/weights.py --report --list     # and the names
uv run scripts/lint.py --all                  # every problem, including ones in the baseline

fill=regular and duotone=regular are expected for open-stroke icons. They are a problem when the icon has a closed shape: open the sheet for it and decide.

When the drawing cannot satisfy a weight

If no arrangement of roles makes one weight work, the icon has too much for the system: simplify the icon (XIDS-DP 3: remove detail that does not communicate). Per-weight artwork or engine special cases are the last resort; they need a change to scripts/build.py and a recorded design decision (see the exceptions in design decisions), because every package depends on the build staying uniform.

Shipping the fix

A redraw is not a breaking change: the name and the API stay, only the pixels change. In the pull request:

  1. Change only icons/<name>.svg. If you fixed a lint problem for an icon in scripts/lint-baseline.json, run uv run scripts/lint.py --update-baseline and commit the smaller file (it can only shrink).
  2. Attach before and after weights sheets.
  3. The release notes should list redrawn icons, since people who pinned screenshots will notice.

If the right fix is a different name, that is a rename, which is breaking: renaming-icons.md.