Skip to content

Color stacks — a layered fill or stroke as an ordered list

Summary
A ColorStack arm and a colorStack token type carry two or more colors or gradients on any paint property, the bottom one first.
Status
ACCEPTED · 2026-11-30
Deciders
Nathan Curtis (author)

Context

Every color-valued style property holds exactly one value. backgroundColor, fillColor, textColor and strokes are all typed ColorStyle — a color string, a ColorObject, a TokenReference, a GradientValue, or null — and it already admits a gradient alongside a solid color (ADR-003). What it does not admit is more than one of them.

A design layer carries no such limit. In Figma a node’s fills and strokes are each an ordered list, composited bottom to top, and the cases that matter are a translucent scrim gradient over a surface color and two gradients blended. Neither is expressible. The transform that reads Figma keeps the first paint it can resolve and discards the rest, so the second paint is not degraded — it is absent, with nothing in the spec recording that it was ever there. That silent loss is the gap.

The change is confined to widening ColorStyle. The type is already the shared umbrella for the four color properties and for the two ContentStyles paints (ADR-102), so a stack reaches all six by adding one arm, with no property added, removed or renamed.


Scope

In scope for a stack item: a solid color and a gradient — the two forms ColorStyle already carries — plus a TokenReference to either.

Also in scope: a token reference to a fill or stroke style holding two or more paints. The reference is how a layer painted by a style has always been captured; what is new is a $type that says what it resolves to (Decision 8).

Out of scope, by decision:

  • Images. An image fill stays a single backgroundImage value (ADR-063). Layering an image with a color is an extremely rare authoring case, has limited relevance across the code platforms, and would be costly to support: it would mean renaming ColorStyle, removing backgroundImage, and a MAJOR change to every consumer, for a case designers barely reach for. ADR-063’s separate-key decision and its “no color-semantics pollution” driver stand.
  • Per-paint opacity, and paints hidden in the design file. Decision 4.
  • Blend modes. A paint carrying a blend mode other than normal is recorded as a plain paint. Nothing here adds a representation for one.
  • A style’s own paints inside the component spec. A layer painted by a style carries the reference, never a copy of what the style holds. Recording the style’s paints is the fetched styles data’s job, and the foundations that read it.
  • Per-character text fills and per-region vector fills. A text node whose characters carry different fills, or a vector network with per-region fills, remains unrepresented.

Decision Drivers

  • The single-color case is the overwhelming majority and must not pay for the stacked case — a spec carrying one color reads identically after this change, and so does every consumer handling one.
  • Additive only — no type renamed or removed, no property added or removed, no existing document stops validating.
  • Order is data, not derivation — Figma emits an ordered list; the contract carries that order rather than leaving each consumer to reconstruct it.
  • Type ↔ schema parity — every new type lands in types/ and in styles.schema.json, and every new named schema definition gets a named type (constitution I).
  • No logic in this package — the contract carries the list; collapsing a one-item list, reversing it, and compositing belong to the transform packages (constitution II).
  • Minimal public API — one new exported type, justified; no second type added for a shape that composes from what exists (constitution III).
  • Naming governance — code platforms outrank Figma; a term two or more code platforms share wins (constitution VI).
  • Every Styles property declares a default — unchanged here; the four keep default: null (ADR-113, DSPEC-44).
  • A platform binding declares a disposition for every Styles property — a widened value form is a mappings/bindings/*.json obligation, not an optional follow-up (DSPEC-41/42).

Options Considered


Decision 1: Representing a stack

Option A: An array arm on ColorStyle (Selected)

A color property accepts either a single value or an ordered array of them. The single form is byte-identical to today.

# Single — unchanged
backgroundColor: '#FF6600FF'
# Stacked — new
backgroundColor:
- { $token: 'Color/Surface', $type: color }
- type: LINEAR
angle: 180
stops:
- { position: 0, color: '#00000000' }
- { position: 1, color: '#00000099' }

Pros:

  • No existing spec changes, and no consumer handling one color changes behavior.
  • A stack reaches all six color properties through the type they already share, with no property added.
  • The arm composes from the forms ColorStyle already carries, so the item grammar is the one authors know.

Cons / Trade-offs:

  • One concept now has two shapes, and a consumer that enumerates ColorStyle’s forms gains a case.
  • Order is meaningful only in the array form.

Option B: Always an array (Rejected)

Every color property is always a list, one value or many.

Rejected because: it taxes the single-color majority with a wrapper and rewrites every existing spec and consumer for a feature a minority of layers use. It fails the first two drivers outright.

Option C: A sibling stack property per surface (Rejected)

Keep the scalar key and add backgroundColorStack, strokesStack, and so on.

Rejected because: one concept would live in two properties that contradict each other when both are set, and it adds four keys to the property surface against constitution III — where Option A adds none.


Decision 2: How many items an array holds

Option A: Two or more — minItems: 2 (Selected)

A lone value always uses the scalar form; an array is itself the signal that the value is a stack.

Pros:

  • A single color has exactly one representation, so diffs and equality checks need no normalization step.
  • The presence of an array carries meaning rather than being an incidental container.

Cons / Trade-offs:

  • A producer reading a one-paint Figma list collapses it to the scalar — a trivial step, but a step.

Option B: One or more — minItems: 1 (Rejected)

Rejected because: a single color would have two valid spellings, and every consumer, diff and validator would have to treat '#FF6600FF' and ['#FF6600FF'] as the same value. Deterministic output — same input, identical output — is a workspace convention, and two spellings for one value leaves the choice to the producer.


Decision 3: Array order

Option A: Bottom value first (Selected)

Index 0 is the paint furthest back; the last item is on top.

backgroundColor:
- { $token: 'Color/Surface', $type: color } # bottom — the surface
- type: LINEAR # top — the scrim
angle: 180
stops:
- { position: 0, color: '#00000000' }
- { position: 1, color: '#00000099' }

Pros:

  • Constitution VI rule 1 selects it: SwiftUI’s ZStack children, Jetpack Compose’s Box children, Android’s LayerDrawable layers and UIKit’s CALayer sublayers all paint in list order, back to front. Two or more code platforms agree, so the rule is satisfied without reaching for Figma.
  • It is also the order the Figma plugin API emits, so the capture side records what it read, and the spec’s order matches the source file’s.
  • Only the CSS target reverses, because the background layer list puts the top layer first.

Cons / Trade-offs:

  • It is the reverse of the fill list a designer sees in Figma’s properties panel, so a designer reading the panel top-down reads the spec bottom-up.

Option B: Top value first (Rejected)

Rejected because: it matches CSS and the Figma panel but inverts both mobile platforms and the capture side, so four surfaces reverse instead of one. Rule 1 points the other way, and the panel is a rendering of the data rather than the data.


Decision 4: Per-item opacity and visibility

Option A: No envelope — an item is a color or a gradient and nothing more (Selected)

Transparency rides on a color’s alpha or on a gradient stop’s color, exactly as it does for a single value today.

Pros:

  • A stack item is the same value the scalar form holds, so one grammar covers both.
  • Nothing is introduced that the scalar form lacks, so the arm stays composable from what exists.

Cons / Trade-offs:

  • A paint’s own opacity, distinct from its color’s alpha, has no representation; a layer using one is recorded with the alpha alone.
  • A paint hidden in the design file has no representation. It is absent from the spec, and a round trip does not restore it.

Option B: An envelope carrying opacity and visible (Rejected)

Each item becomes { color, opacity?, visible? }, mirroring Figma’s Paint.

Rejected because: it gives the stacked form a shape the scalar form does not have, and opacity would overlap a color’s alpha with two ways to express one thing. It is Figma’s model rather than any code platform’s, which constitution VI admits only where the alternative loses data — and the alpha channel carries the common case.


Decision 5: Naming the stack type

Option A: ColorStack (Selected)

Pros:

  • “Stack” says what the ordering means — values composited one over another — and distinguishes the list from the contract’s other arrays, which are not stacks: a gradient’s stops, a component’s variants, an element’s children.
  • SwiftUI’s ZStack, Jetpack Compose’s stacked Box and CSS’s stacking contexts all use the word for back-to-front composition, so constitution VI rule 1 applies.
  • It sits under ColorStyle without claiming anything the type does not hold, which a paint- or fill-named alternative would.

Cons / Trade-offs:

  • “Color stack” undersells a stack whose items are gradients, though both are forms of ColorStyle and the name follows the umbrella.

Option B: ColorLayers (Rejected)

Rejected because: “layer” already means a node in Figma and a stacking context in CSS, so the term is overloaded in both of the contract’s neighbouring vocabularies.

Option C: Paints (Rejected)

Rejected because: Paint is Figma’s term for an entry in a fills list, and the code-platform Paint types — android.graphics.Paint, Flutter’s Paint — name a drawing-style object carrying stroke width and blend mode, not one layer of a fill. The word would import Figma’s model under cover of a code-platform name, and it is wrong for a type that holds no image.

Option D: ColorArray (Rejected)

Rejected because: it names the JSON structure rather than what the ordering means.


Decision 6: Which properties accept a stack

Option A: Every property typed ColorStyle — the four, plus both content-style paints (Selected)

PropertyWhat it paintsFigma source
backgroundColorA container’s own surface, behind its contentsfills of a frame
fillColorA glyph or vector shape itselffills of a vector
textColorA text element’s glyphsfills of a text node
strokesThe element’s outlinestrokes of a frame or vector
ContentStyles.$text.textColorA text primitive filling a slot (ADR-102)fills of a text node
ContentStyles.$glyph.fillColorA glyph primitive filling a slot (ADR-102)fills of a vector

All six already share ColorStyle, so widening the type reaches them with no per-property work.

Pros:

  • It matches the source: every Figma fills and strokes list maps to one of these, so no paint a designer applied has to be dropped for lack of a place to put it.
  • One rule covers every property, so the item grammar is learned once.
  • The content-style paints stay in step with their element-level counterparts, which costs nothing because they reference the same definition.

Cons / Trade-offs:

  • Some combinations are harder to render than others — a gradient stroke with rounded corners, or a stacked text fill — so a spec can state a value a given target approximates.

Option B: backgroundColor only (Rejected)

Rejected because: it would mean giving backgroundColor its own value type, splitting the umbrella the four properties share, and the capture side would still find stacked paints on text fills, vector fills and strokes with nowhere to put them. Rendering difficulty is a target concern that changes release by release; encoding it in the contract makes each rendering improvement a schema change.

Option C: Item forms vary by property (Rejected)

For example, gradients admitted in a backgroundColor stack but not in a textColor one.

Rejected because: textColor already admits a gradient today (ADR-003), and the CSS binding already emits the background-clip bundle that paints text with one, so the restriction would remove a working capability. It also splits the shared type for no contract-level reason.


Decision 7: Shadow and gradient-stop colors

Shadow.color and GradientStop.color are each typed as a color string, a ColorObject or a TokenReference — ColorStyle without the gradient and null arms.

Option A: They stay a single solid color (Selected)

Neither type changes, and neither gains the stack arm. Layering for both already exists one level up: effects.shadows is a list, and a gradient’s stops is a list.

Pros:

  • It matches every target and the DTCG format: one color per box-shadow layer, one color per Gradient.Stop in SwiftUI and Compose, one color per DTCG shadow and per DTCG gradient stop.
  • The composition these fields need already works where it belongs — in the list of shadows and the list of stops.
  • Effects.ts and Gradient.ts are untouched, so the change stays confined to ColorStyle.

Cons / Trade-offs:

  • A color field’s admitted forms now depend on where it sits: backgroundColor takes a stack, a shadow’s color does not. Both type comments already state that asymmetry for the gradient arm, and will state it for this one.

Option B: They accept the full ColorStyle (Rejected)

Rejected because: no target renders a stack as a shadow color or a gradient stop, so a generator could only flatten the value or drop it — and constitution II puts flattening outside this package, while DSPEC-43 forbids inventing the data a flatten would need.


Decision 8: A reference to a stacked fill or stroke style

A Figma fill or stroke style can itself hold two or more paints. A layer painted by one carries a TokenReference — that is how every applied style has always been captured, and it does not change. The style’s own paints live in the fetched styles data, not in the component spec, so nothing about the layer is lost by referencing rather than copying.

What the spec cannot currently say is what the reference resolves to. $type is a closed set, and a style holding a solid color plus a gradient is neither a color nor a gradient.

Option A: A colorStack token type (Selected)

TokenReference.$type gains 'colorStack'. A style holding one paint keeps the $type it carries today, so every reference a consumer reads now is unaffected; only a style holding two or more takes the new value.

# A layer painted by a two-paint fill style
backgroundColor:
$token: Overlay/Scrim on surface
$type: colorStack

What the type names is the grammar ColorStack already carries: an ordered list of solid colors, gradients, or token aliases to either, the bottom value first.

Pros:

  • $type exists to say what a reference resolves to, and this is the one case where it could not. A consumer that must build a layer list knows to look for one.
  • It follows the precedent the set already holds: effects names a multi-shadow composite and image names a fill style whose paint is an image, both Specs extensions for shapes DTCG has no type for.
  • The style keeps its identity. A change to the style reaches every spec that references it, and a round trip restores the binding rather than a copy of its paints.
  • A one-paint style is untouched, so no consumer expecting color or gradient to resolve to a single paint changes.

Cons / Trade-offs:

  • The paint count is known only after resolving the token, so a consumer cannot tell a stack from a single paint by reading the reference alone — it can only tell that it is one.
  • colorStack is camelCase where every other member is a single lowercase word. No single lowercase word names it: stack alone does not say what is stacked.

Option B: Reuse $type: color (Rejected)

Rejected because: color would resolve to something that is not a color, which is the one guarantee the field exists to give. Every consumer would have to resolve a reference before it could know the shape, including the ones that only ever wanted a solid color.

Option C: Inline the style’s paints into the spec (Rejected)

Rejected because: the spec would carry a copy of what the style holds, so the link to the style is lost — a change to the style would reach no spec, and a round trip could not restore the binding. It also contradicts how every other applied style is captured, for the one style kind that happens to hold more than one value.


Decision

Type changes (types/)

FileChangeBump
Styles.tsAdded ColorStack — (ColorString | ColorObject | TokenReference | GradientValue)[], two or more items, bottom value firstMINOR
Styles.tsColorStyle gains the ColorStack armMINOR
Styles.tsTokenReference.$type gains 'colorStack' (Decision 8)MINOR
Styles.tsNone to Styles itself — the four properties keep their declarations and pick up the widened type—
Gradient.tsGradientStop.color is unchanged (Decision 7); its comment names the stack among the arms it excludesPATCH
Effects.tsShadow.color is unchanged (Decision 7); its comment names the stack among the arms it excludesPATCH
Image.tsNone — an image fill is out of scope—
index.tsExports ColorStackMINOR

Example — the new shape (types/Styles.ts):

# Before
ColorStyle: ColorString | ColorObject | TokenReference | GradientValue | null
# After
ColorStack: (ColorString | ColorObject | TokenReference | GradientValue)[] # two or more, bottom first
ColorStyle: ColorString | ColorObject | TokenReference | GradientValue | ColorStack | null

Schema changes (schema/)

FileChangeBump
styles.schema.jsonAdded #/definitions/ColorStack — array, minItems: 2, items as oneOf of ColorString, ColorObject, TokenReference, GradientValueMINOR
styles.schema.json#/definitions/ColorStyleValue gains a ColorStack branch in its oneOf, and its description names the stacked formMINOR
styles.schema.jsonTokenReference.$type gains a 'colorStack' const branch with a title and description (ADR-114, DSPEC-48/49)MINOR
styles.schema.jsonColorStack.items’ token arm excludes $type: 'colorStack', so a stack never nestsMINOR
styles.schema.jsonStyles.backgroundColor, fillColor, textColor, strokes — unchanged; they $ref ColorStyleValue and keep default: null—
styles.schema.jsonTextContentStyles.textColor, GlyphContentStyles.fillColor — unchanged; same $ref—
styles.schema.jsonGradientStop.color and Shadow.color descriptions note that the stack arm is excluded alongside the gradient and null armsPATCH
component.schema.json, component-concern.schema.json, composition-concern.schema.jsonNone — the element and variant styles blocks reach ColorStyleValue by $ref—
mappings/bindings/figma.jsonThe four color rows state their handling of the stacked form; the single-paint write becomes a list write (DSPEC-41/42)MINOR
mappings/bindings/css.jsonThe four color rows state their handling of the stacked form and the list reversal for background (DSPEC-41/42)MINOR
SPECIFICATION.mdTwo new DSPEC rows: a producer writes a ColorStack bottom value first and uses the scalar form for one value; a consumer composites in list order, reversing where the platform paints the topmost layer firstMINOR

Example — what a spec carries:

default:
elements:
hero:
styles:
# a scrim gradient over the brand surface
backgroundColor:
- { $token: 'Color/Surface', $type: color }
- type: LINEAR
angle: 180
stops:
- { position: 0, color: '#00000000' }
- { position: 1, color: '#000000B3' }
# a two-value stroke, both token-referenced
strokes:
- { $token: 'Color/Outline', $type: color }
- { $token: 'Color/Outline variant', $type: color }
variants:
- configuration: { disabled: true }
elements:
hero:
styles:
backgroundColor: { $token: 'Color/Surface disabled', $type: color }

Notes

  • No named item type. ColorStack holds the four single forms directly rather than referencing a named “one color style” type. A second exported name would have to justify itself as a genuine shared concept (constitution III), and nothing else needs it: GradientStop.color and Shadow.color take a narrower set (no gradient), so they would not reuse it.
  • A variant replaces the whole value. Nothing changes, and nothing needs to: a style value is replaced wholesale by a variant, as gradients, effects and typography already are. A variant may swap a stack for a single color, change the number of values, or clear the value with null. Merging a stack item-by-item by position is not introduced — no other style value merges that way, and a variant with fewer values would leave the base’s extra values behind.
  • Defaults are unchanged. All four properties keep default: null (ADR-113, DSPEC-44), and null keeps its present meaning: no paint, including as a variant’s way to clear an inherited one.
  • Color notation is per item. DSPEC-39 — when settings.spec.color is not OBJECT, every color-bearing value in the document is a string in that notation — applies to each item of a stack independently. Stacking raises no new notation question.
  • A stack never nests, in either of the two ways it could. The array arm is not among ColorStack’s items, and the items’ token arm excludes $type: 'colorStack' with a not — a stack-valued token is a whole value, never one item inside another stack. Both are structural, so no specification row is needed. The second guard is schema-only: TypeScript cannot express “a TokenReference whose $type is not this one” without a conditional type the contract does not otherwise use.
  • A colorStack token caches no raw value. $extensions['com.figma'].rawValue holds what a variable resolved to at extraction. A colorStack reference is a fill- or stroke-style reference, which a render applies by style id rather than by variable, so there is nothing for it to cache and nothing to degrade to — exactly as for an image token (ADR-063).
  • colorStack, not color_stack or colorstack. The set’s two existing Specs extensions are single lowercase words (effects, image) because single words were available. This concept has no single word, and the member is named for the type it resolves to, so the type’s spelling carries over.
  • Ordering is the one rule the schema cannot express, so it needs a specification row. JSON Schema can state that ColorStack is an array of two or more color values; it cannot state which end is on top. That is what §1.5 of SPECIFICATION.md makes the test for a DSPEC row.

Type ↔ Schema Impact

  • Symmetric: Yes.
  • Parity check:
    • ColorStack (types) ↔ styles.schema.json#/definitions/ColorStack — same item forms, same two-item minimum.
    • ColorStyle (types) ↔ #/definitions/ColorStyleValue — both gain the stack arm and nothing else.
    • No definition is added without a named exported type, and no type is added without a definition (constitution I, both directions).
    • GradientStop.color and Shadow.color stay identical on both sides; only their descriptions change.

Downstream Impact

ConsumerImpactHighlights
specs-cliUpdate usageValidation fixtures and authoring templates carry the stacked form; the CSS transform reverses the list for the background layer order
specs-from-figmaUpdate usageCapture emits the full ordered list instead of the first resolvable paint, and collapses a one-item list to the scalar
figma-from-specsUpdate usageRender writes the whole list to fills or strokes in spec order, replacing the current single-paint write
react-from-specsUpdate usageEmitted styles carry a layered background or stroke where the spec has one
webcomponents-from-specsUpdate usageSame as React
from-specs (shared core)Update usageShared color value handling branches on the array form
specs-plugin-2Update usageThe output page presents a stacked fill or stroke value as one composite swatch; the paint behavior itself lives in figma-from-specs

Per-package implementation analysis: specs-local-workspace/adr/130/plan.md (maintained outside this repo).


Semver Decision

Target version: 0.42.0 — the version of the active release/next branch this ADR merges into.

Change class: MINOR — one additive exported type (ColorStack), one additive arm on an existing value union, and one additive member on the $type set. No type is renamed or removed, no property is added or removed, no field changes presence, and every document that validates today still validates (constitution III, versioning policy).


Consequences

  • A spec can state that a surface is painted by more than one color or gradient, and in what order — a layered fill or stroke the contract previously had no way to carry.
  • A layer’s paints beyond the topmost one survive capture, so a spec records every paint the design carries rather than only the one in front.
  • A single color is written exactly as it is today, so no existing spec changes and no consumer handling one color changes behavior.
  • A consumer that enumerates ColorStyle’s forms gains one case — the array — and a consumer that ignores the arm keeps working on every spec without a stack.
  • A layer painted by a fill or stroke style holding two or more paints says so: its reference carries $type: colorStack instead of claiming to resolve to a single color or gradient. A consumer that resolves tokens gains one more type to resolve; one that does not is unaffected.
  • A consumer enumerating $type gains a member, and a consumer switching on it exhaustively needs a branch for it.
  • An image fill stays its own property, so a layer carrying both an image and a color still splits across two keys with no order between them. That loss is unchanged by this ADR, and the Figma write side continues to decide the order by appending.
  • A paint hidden in the design file, a paint opacity distinct from color alpha, and a non-normal blend mode remain unrepresentable, and a round trip does not preserve them.
  • A stack of opaque solid colors is degenerate on every target — the top value hides the rest — so which stacks render meaningfully stays an authoring judgment rather than a schema constraint.