Skip to main content

Styles, Swatches & Fonts

Typograph does not use a traditional "paragraph/character/object styles" system where styles are defined globally and applied by name. Instead, visual style is expressed two ways:

  1. Swatches — color values defined once at the document level, referenced by UUID from pages and elements.
  2. Per-element formatting — rich-text elements carry their own font, size, and inline tag runs; geometric properties (stroke width, shadow, opacity, blend mode) live directly on each element.

Swatches

A swatch is a named color definition stored in the document's swatches array:

PropertyDescription
uuidStable identifier used by pages and elements
nameHuman-readable name
modelPROCESS, SPOT, or GRADIENT
rgb, cmyk, labColor values in one or more color spaces
tintDefault tint value (0–1)

A document must contain at least 4 swatches.

Using a Swatch

Pages and elements don't embed raw colors — they reference swatches:

fillSwatchUuid:     "019b28fb-a11e-7641-a28f-e978f892ec06"
fillTintValue: 0.8
strokeSwatchUuid: "019b28fb-a11e-7641-a28f-e978f892ec07"
strokeTintValue: 1.0
shadowSwatchUuid: "019b28fb-a11e-7641-a28f-e978f892ec08"

Changing the swatch definition propagates to every page and element that references it by UUID.

Gradient Swatches

Gradient swatches use model: GRADIENT and carry stop definitions. Elements apply them via gradientFillAngle, nativeGradientFillStart, nativeGradientFillLength, and the matching ...Stroke... fields.

Fonts

Fonts used in the document are declared in the top-level fontData array. Each entry names a font and points at a font asset resolved through the File Service (see File Service — project fonts with presigned URLs).

Text elements (type: rich) reference fonts by name:

PropertyDescription
fontNameName of a font declared in fontData
fontSizeSize in native units
fontStyleRegular, italic, weight, etc.
defaultFontFallback if the named font isn't available

Inline formatting (runs of bold, italic, or differently-styled text) uses a Tag-based model embedded in the rich-text content.

Element-Level Visual Properties

Properties normally thought of as "object styles" live on each element directly, not in a shared style sheet:

  • Border: nativeBorderSize, strokeDash
  • Shadow: shadow, shadowAngle, nativeShadowOffsetX/Y, nativeShadowBlur
  • Opacity: opacity (0–1)
  • Blending: blendMode — one of 26 values, see Elements → Blend Modes
  • Rotation: angle, rotationCx, rotationCy

These don't refer to a global style definition; they're set per element. Shared look-and-feel comes from using shared swatches.

Why This Model?

The editor is optimized for interactive, direct manipulation — designers tweak an element and see the change immediately. Color consistency is maintained through the swatch palette; typography through fontData. This keeps the document portable (no external stylesheet to ship alongside) while still allowing documents-wide color and font changes to propagate through a single edit.