Skip to content

Theme and colors

theme.json holds your app’s design tokens and presets. Components refer to them by name, so changing a color here changes it everywhere.

{
"schemaVersion": "1.0.0",
"styleVersion": "0.1.0",
"tokens": {
"colors": {
"background": "#F8FAFC", "surface": "#FFFFFF", "primary": "#2563EB", "secondary": "#7C3AED",
"text": "#0F172A", "muted": "#64748B", "border": "#CBD5E1", "error": "#DC2626", "success": "#16A34A"
},
"typography": {
"body": { "fontFamily": "system", "fontSize": 16, "fontWeight": 400, "lineHeight": 24 },
"title": { "fontFamily": "system", "fontSize": 28, "fontWeight": 700, "lineHeight": 36 },
"caption": { "fontFamily": "system", "fontSize": 12, "fontWeight": 400, "lineHeight": 16 }
},
"spacing": { "none": 0, "xs": 4, "sm": 8, "md": 16, "lg": 24, "xl": 32 },
"radii": { "none": 0, "sm": 4, "md": 8, "lg": 16 }
},
"presets": {
"page": { "padding": "$spacing.md", "gap": "$spacing.md", "backgroundColor": "$color.background" },
"panel": { "padding": "$spacing.md", "radius": "$radius.md", "backgroundColor": "$color.surface", "shadow": "subtle" },
"heading": { "typography": "$typography.title", "color": "$color.text" }
}
}
  • All nine colors are required, each as #RRGGBB. There are no hidden defaults.
  • Typography has three sizes: body, title, caption. The font is always the iPhone system font.
  • Spacing and radii are whole numbers of points.

Where each color is used is listed in Style options.

A preset is a named bundle of style options. Define the looks you repeat (a page, a panel, a heading, a note) once, and use them with "preset": "panel". You can add as many presets as you like.

There is one theme per app. For a dark app, set dark values:

"colors": {
"background": "#0B1020", "surface": "#141A33", "primary": "#8F82FF", "secondary": "#4FA8FF",
"text": "#EEF0FF", "muted": "#A3AAD6", "border": "#2A3166", "error": "#FF7088", "success": "#3DDC97"
}

Check that text on background and on surface is easy to read; Ynch does not adjust colors for you.