ADR
A library declares which paint property colours its glyphs
Context
conventions records facts about the library a spec was generated from — things every consumer of that library must declare identically, and which no consumer can re-derive. The file’s own contract states the standard: differing values produce incorrect output, not merely different output.
The glyphs block (ADR-103) carries two forms, and a component matching either is a glyph:
| Form | Membership | Glyph name |
|---|---|---|
match | the component name matches the pattern | the {i} capture |
structure | the component’s children match the declared structure | the component name |
Both forms answer which components are glyphs. Neither answers how a glyph is coloured, and a library’s answer to that is the same kind of fact: uniform across its icon set, and not inferable without guessing.
A stroked icon set has no capturable colour
A glyph’s colour is reached through fillColor, which is the only paint key an element of type glyph carries. The value is resolved by descending from the instance, because the paint sits on a leaf rather than on the instance itself.
That descent reads fills. An icon set drawn with strokes therefore has no colour anywhere in its specs — not absent for one component, absent for every glyph in the library:
# What the library holds: one vector, stroked, no fillIcon/check: VECTOR Glyph: fills: [] strokes: [{ type: SOLID, color: … }] strokeWeight: 2 strokeAlign: CENTER
# What a component instancing it records for its glyph elementelements: root: styles: width: { $token: DS Primitives/size/16, $type: dimension } height: { $token: DS Primitives/size/16, $type: dimension } content: check # no colour, in any variantThe loss compounds into the variant set
A component exposing a colour prop over such an icon set records no difference between its colour values, because the only thing that differs is a paint the capture does not read. Every colour variant then diffs as identical to the default and is discarded as empty. A nine-value colour prop reaches the spec as a prop with no variant carrying it — the prop surface survives and the appearance it selects does not.
The block already asserts how a glyph is painted
GlyphStructure.fill lists the leaf fills a glyph’s structure is allowed to carry. So the glyphs block already makes a paint assumption; it simply makes only one, and that one presumes fills.
Out of scope
- Which schema key the captured colour is recorded under. The spec says a glyph’s colour is X; which Figma property drew it is the library fact this ADR declares, so it does not also belong on the element. Recorded as downstream impact, not resolved here.
- Whether
GlyphStructure.fillneeds the same treatment. A stroked library cannot satisfy an accepted-fills test, so the structural form is closed to it until that member is generalised. That is the same contradiction one level down and is left to its own ADR. - How a producer resolves a value it reads. The schema declares where a fact is recorded; it cannot express a resolution order (Principle II).
Decision Drivers
- Type ↔ schema parity (Principle I) — any field added to
types/has a counterpart inschema/, both ways. - No logic (Principle II) — the schema declares the library fact. It cannot express how a producer resolves a paint, and must not try to.
- The contract’s own coherence (Principle III) — the justification is that
conventionsexists to carry exactly this class of fact, and that the block already carries one paint assumption. No consumer’s internal model is cited. - Minimal, stable API (Principle III) — one additive optional field on the block that already governs glyph identity, not a new block or a parallel convention.
- Naming governance (Principle VI) — rule 3 applies: no code platform expresses an opinion about which Figma property a library draws an icon with, and the values are Figma’s own property names, so deviating would cost data faithfulness.
- Additive only — the field is optional and absent from every conventions file written to date, so no existing document becomes invalid.
- A declaration is believed — the file’s contract is that a wrong value produces incorrect output. Whatever is declared is used, with no inference behind it.
Options Considered — where the fact is recorded
Option A: A member on PlatformConventions.glyphs (Selected)
glyphs: match: 'Icon/{i}' colorProperty: strokesPros:
- It is a fact about glyphs, and
glyphsis the block that already governs what a glyph is and — throughstructure.fill— how one is painted. - The block’s contents are the icon cache’s identity, so a change to the declaration already invalidates cached icons through the existing mechanism rather than needing a new one.
- One optional field. A library that fills its glyphs declares nothing new.
Cons / Trade-offs:
- The block then carries two kinds of member — which components are glyphs, and how they are coloured. The schema description has to say so, since “a declared block carries at least one form” no longer describes every member.
Option B: A member on PlatformConventions, beside glyphs (Rejected)
Rejected because: it reads as a platform-wide fact about paint when it is a fact about glyphs alone, and it would sit outside the block whose signature governs icon-cache identity — so changing it would leave a stale icon cache that nothing invalidates.
Option C: A member on GlyphStructure (Rejected)
Rejected because: structure is one of two membership forms, and how a glyph is coloured is independent of which form identifies it. A library declaring match alone would have nowhere to put the fact, which is precisely the library this ADR is for.
Options Considered — what the member holds
Option A: The Figma paint property, as a closed enum (Selected)
fills or strokes, naming the property a glyph’s colour is read from.
Pros:
- The set is closed because Figma has exactly two paint properties a vector carries, so an open string would admit values that cannot mean anything.
- One value per library matches the fact being declared — an icon set is drawn one way.
- Satisfies Principle II: a property name is a location, not a rule.
Cons / Trade-offs:
- A library that genuinely mixes filled and stroked icons cannot describe itself. That is a library with two icon conventions, and the honest answer is that it declares neither rather than that the contract grows a list.
Option B: An ordered list of properties (Rejected)
Rejected because: a list is only useful if a consumer tries each in turn, which is a resolution order expressed in the schema — Principle II forbids it. It also defeats the file’s contract that a wrong declaration produces incorrect output: a fallback turns a wrong declaration into a silently different one.
Option C: A shape naming the property, weight and alignment (Rejected)
Rejected because: weight and alignment live on the glyph’s own component in the library and are inherited by every instance of it, so no consumer needs them declared. Recording them would put drawing detail in the contract that no code platform reads.
Options Considered — vocabulary
Option A: colorProperty (Selected)
Pros:
- It names what the member holds — the property a colour is read from — rather than the colour or the act of painting.
glyphs.matchandstructure.fillestablish short, Figma-facing member names in this block;colorPropertyreads as one of them.- Principle VI rule 3: no code platform has an opinion on which Figma property draws an icon, and the values are Figma’s own property names, so Figma’s vocabulary is deferred to for the values while the member name states the relationship.
Option B: paint (Rejected)
Rejected because: Paint is Figma’s type for a fill or stroke value, so the member would read as the colour itself rather than as which property carries it.
Option C: colorFrom (Rejected)
Rejected because: it reads as a source location — a file, a collection, a token set. The member names a property on a node, which Property states directly.
Decision
Type changes (types/)
| File | Change | Bump |
|---|---|---|
Conventions.ts | Added optional field colorProperty?: 'fills' | 'strokes' to PlatformConventions.glyphs | MINOR |
Conventions.ts | Added the same optional field to ResolvedPlatformConventions.glyphs | MINOR |
Example — new shape (types/Conventions.ts):
# BeforePlatformConventions.glyphs: match?: string structure?: GlyphStructure
# AfterPlatformConventions.glyphs: match?: string structure?: GlyphStructure colorProperty?: 'fills' | 'strokes' # optional — MINORSchema changes (schema/)
| File | Change | Bump |
|---|---|---|
conventions.schema.json | Added property colorProperty to #/definitions/PlatformConventions/properties/glyphs | MINOR |
Example — new shape (schema/conventions.schema.json):
# New property under #/definitions/PlatformConventions/properties/glyphs/propertiescolorProperty: description: "The Figma paint property a glyph's colour is read from." oneOf: - const: fills description: "…" - const: strokes description: "…" # not in required[] — optional field"additionalProperties": false on the glyphs object is unchanged; colorProperty is declared explicitly.
Specification changes (SPECIFICATION.md)
A producer that ignores the declaration emits a document that validates and is wrong, which draft-07 cannot catch. §9 gains one rule-catalogue row under a fresh DSPEC-84, bound to the producer class and sourced to the conventions reference: a producer reads a glyph’s colour from the property glyphs.colorProperty names, treats an absent declaration as fills, and records what it reads as fillColor whichever property carried it.
Notes
- Optional, with a default of
fills. Absence means the library fills its glyphs, which is what every consumer assumes today, so no existing conventions file changes meaning. - It is not a membership form. A declared
glyphsblock must still carrymatch,structure, or both;colorPropertyalone identifies no components and does not satisfy that requirement. The schema description states this. - It changes the block’s recorded signature. The
glyphsblock’s contents are what a workspace records to decide whether its cached icons are current, so adding the member to an existing declaration causes one refetch of icons. Automatic, and worth stating.
Type ↔ Schema Impact
- Symmetric: Yes, with a pre-existing asymmetry in this file’s coverage.
- Parity check:
PlatformConventions.glyphs.colorPropertyintypes/Conventions.ts↔#/definitions/PlatformConventions/properties/glyphs/properties/colorPropertyinschema/conventions.schema.json, typed'fills' | 'strokes'↔ a two-memberoneOfofconsts. ResolvedPlatformConventionshas no JSON schema definition and never has —conventions.schema.jsonmodels the authored document, and the resolved form is what remains after defaults are applied. The second type change therefore has no schema counterpart, which is this file’s existing shape rather than drift introduced here.
Downstream Impact
| Consumer | Impact | Highlights |
|---|---|---|
specs-cli | Update usage | Resolves the conventions document into the resolved form, so the new member must survive resolution; the scaffolded conventions template is where a library declares it |
specs-from-figma | Update usage | Reads a glyph’s colour from the declared property rather than from fills unconditionally |
figma-from-specs | Update usage | Writes a glyph’s colour to the declared property, or the value is captured and lost on the return trip |
react-from-specs | None | Reads the element contract; a glyph’s colour reaches it as fillColor either way |
webcomponents-from-specs | None | Same as react-from-specs |
from-specs | None | Shared emitter core, same contract surface as the two emitters |
specs-plugin-2 | Update usage | Constructs its conventions from panel settings rather than from a file, so the member is unreachable there until the panel can express it |
Semver Decision
Target version: 0.42.0 — the version of @directededges/specs-schema on the active release/next branch.
Change class: MINOR — for CHANGELOG placement, not a version bump.
Justification: One additive optional field on an existing interface, with its declared schema counterpart. No type or property is removed, renamed, or made required, and every conventions document valid before remains valid and keeps its meaning. Constitution “Versioning”: MINOR for additive types or new optional fields.
Consequences
- A library that strokes its icons can state so, and a glyph’s colour becomes capturable there for the first time.
- A colour prop over a stroked icon set produces variants that differ, so they stop being discarded as empty.
glyphscarries two kinds of member: which components are glyphs, and how a glyph is coloured. The block’s description says so, and the at-least-one-form requirement is stated against the membership forms rather than against the block.- A consumer reading a conventions document that declares nothing behaves exactly as today, so the field’s absence needs no handling beyond the default.
- Adding the member to an existing declaration refetches that workspace’s icons once, through the staleness mechanism that already watches the block.
- The structural form stays closed to a stroked library, because
GlyphStructure.filltests fills a stroked glyph does not have. Raised here, decided elsewhere.