Skip to content

glyphs

Conventions used to detect glyph content assets (e.g. icon glyphs). A library fact: every consumer reading the same library must declare the same conventions — a wrong or missing declaration leaves icon assets undetected, and absence means the library has no glyph convention and no detection is performed.

Fileconfig/conventions/figma.yaml
Pathglyphs.match, glyphs.structure and glyphs.colorProperty
Typeblock with match (string) and/or structure (object) — at least one — plus optional colorProperty
Defaultabsent (no glyph convention)

Options

A declared block carries at least one of two membership forms; a component matching either is a glyph:

FormMembershipGlyph name
matchcomponent name matches the patternthe {i} capture
structurecomponent’s children match the declared structurethe component name (through structure.name)

colorProperty is not a membership form — it identifies no components, and a block carrying it alone is invalid.

PropertyValuesDefaultReads a glyph’s colour from
colorPropertyfills | strokesfillsthe named paint property, descending to whichever layer inside the glyph carries it

Declare strokes when the library draws its icons as outlines. An icon set whose vectors carry fills: [] and a stroked path has no colour to capture otherwise, and a component exposing a colour prop over such a set records no difference between its colour values — so every colour variant diffs as identical to the default and is dropped.

glyphs:
match: 'Icon/{i}'
colorProperty: strokes

A stroked library cannot use structure.fill, which tests fills its glyphs do not have, so it identifies membership through match.

Example

# Name form — the library names its glyph components by a pattern
glyphs:
match: 'DS Icon Glyph / {i}'
# Structural form — glyph components are plainly named ("Cross", "Chevron down")
# but share a consistent child structure
glyphs:
structure:
fill: ['#161616']
children:
- type: VECTOR
name: 'Vector'

Result

When the pattern matches, the layer is typed as a glyph in the anatomy and its matched name is captured as the element’s content. From the DS Alert output, the decorativeIcon glyph carries the resolved icon name:

{
"anatomy": {
"decorativeIcon": { "type": "glyph" }
},
"default": {
"elements": {
"decorativeIcon": {
"styles": {
"width": 20,
"height": 20,
"fillColor": { "$token": "DS Color/Alert/Info/Element", "$type": "color" }
},
"content": "info"
}
}
}
}

Without a glyphs block, the layer is treated as an ordinary element and no content glyph name is extracted.

match

The pattern must include the {i} placeholder, which marks where the glyph name appears in the component name. Internally {i} becomes a (.+) capture group and the matched text is used as the glyph’s content value. See Icon Glyphs for the full pattern syntax.

{i} is the asset-name placeholder generally, not only the icon-name one — images.match uses it to capture an image’s name. The property it sits in says which asset is being named.

structure

Declares the child structure a glyph component has in this library, for libraries whose glyph components are plainly named (Cross, Chevron down) and carry no name pattern.

A glyph cannot have properties: a component declaring component properties — variants, text, swaps — is a configurable component, and the structural form never claims it. A component set and its variants are property-bearing by construction and are never structural glyphs.

MemberTypeMeaning
childrenlist of node matchersRequired. A component is a glyph when every one of its children matches some entry — exhaustive: a component containing anything besides the declared shapes is not a glyph
namestringNaming rule applied to the component name, using {i} (e.g. '{i}Icon'). Defaults to '{i}' — the whole component name is the glyph name
filllist of stringsAccepted leaf fills: a raw color ('#161616') or a token/variable/style name. When declared, every matched leaf of the component’s stored structure must carry one of them; a placed instance is recolored by context, so the fill test is skipped on instance mirrors. Absent, fills are not tested

Each node matcher carries a required type (Figma node type, e.g. VECTOR, BOOLEAN_OPERATION), an optional name (literal with * wildcard), and optional nested children with the same exhaustive semantics:

# One level deeper: component → BOOLEAN_OPERATION → vectors
glyphs:
structure:
children:
- type: BOOLEAN_OPERATION
children:
- type: VECTOR
name: 'Glyph - *'

Legacy name

In the pre-split specs.config.yaml, this option was the scalar config.processing.glyphNamePattern. That file is no longer read — specs migrate config converts it, moving that member to figma.glyphs.match.

Further reading