Skip to content

Theme a micro-app

A pack decides what a document can say: its components and their props. A theme decides how it looks: colours, fonts and corner radius. Each pack ships with a default theme, Signal’s citrus and Nocturne’s ember. A host can give the same document its own brand with a theme. The document doesn’t change: it never names a theme, and meta.pack stays as it is.

Pick a theme above the preview. The document is the same in each.

A person makes a few typed choices, and createTheme derives everything else:

Choice Values Default
brand A colour, #rgb or #rrggbb. Fills solid buttons, selected options and avatars. Required
accent A colour for accent text, focus rings and heading accents. The brand
mode light or dark. Required
fonts.body, fonts.display A stack name (system-sans, humanist, grotesk, serif-editorial, mono) or one family name: letters, digits, spaces and hyphens, at most 40. humanist; display follows body
radius none, small, medium or large. medium
neutralHue The hue of the greys, in degrees from 0 to 360, for warmer or cooler neutrals. The brand’s hue; untinted greys for a grey brand
name A label for people choosing between themes. Never rendered. None

From those choices Mica builds every colour, font, radius and shadow the pack’s components read: nearly 90 values.

  • Readable text. createTheme adjusts each text colour until it reaches its contrast floor, so you never have to check it by hand. Body text gets at least 7:1. Muted, accent, error and help text, and the text on solid buttons and selected options, get at least 4.5:1. Focus rings and the fill of a selected option or an on switch get at least 3:1. A brand colour too light or too dark for white text gets dark or light text instead.
  • Two schemes. The scheme in effect comes from the nearest container that paints its own opaque background. Paper and mist pages use the base scheme. Ink pages, sections and surfaces use an inverse scheme: controls, menus that open inside the section, ghost buttons, and help text and required marks get their own colours on ink, so a form inside an ink section stays readable. A paper, soft or accent surface, or a raised section, uses the base scheme when the base page text, control text and required marks stay readable on its background and the base control, help and required colours meet the floors published for them, and the ink scheme when only the ink colours do. It then sets its inherited text to that scheme’s page text, so a light surface inside ink is not left with light text, and a dark raised section is not left with dark text. An outlined section is see-through, so it keeps the scheme around it. A combobox list, a date picker and any other popover take the scheme of the control that opened them. Tone text follows the scheme too: on ink, muted text (and value labels, empty values and quote attribution) and image captions take the ink help colour, accent text the ink eyebrow colour, a quote’s mark the ink heading accent, and eyebrows and heading accents their ink colours, so each still reads at 4.5:1. inverse text is a tone made for ink; in the packs it is lighter than muted text there. The Talk to us first section above shows this.
  • No CSS from people. Colours are parsed and written back as numbers, and fonts come from the stack names or a plain family name. Anything else is refused with the name of the field. A stored theme is checked again when it is loaded.

The pack’s default themes use the same two schemes and meet the same contrast floors, measured in the colour each container shows: Nocturne’s dark raised section takes the ink scheme, so its text is the ink page colour. Nocturne’s controls are light on its paper and mist pages and dark on ink. Signal’s muted text, eyebrow and light-page heading accent, and Nocturne’s muted and accent text, are darker on paper and mist than before, in the same hue, and switch to their ink colours on ink. Nocturne’s required mark is darker too, so its citrus surface takes the base scheme on every page.

Click Theme in the designer’s top bar. The Theme panel takes the place of the component palette, with a field for each choice in the table above. The canvas shows the document under the theme as you type, and Preview uses it too. The theme belongs to the designer, not the document: it is never written into the document, its history or its export, and it stays when you start a new document or switch packs.

The Theme panel beside the canvas: brand, accent, fonts and radius chosen, and the canvas already showing them.

  • Every change applies at once. A value Mica refuses, such as a colour that isn’t #rgb or #rrggbb or a family name with punctuation, is named under its field, and the canvas keeps the last theme that worked.
  • Use pack default goes back to the pack’s own theme. The panel keeps your choices, and Apply these choices brings them back.

Two buttons read a file you already have and suggest values for the fields. Each suggestion has buttons that copy it into a field: Brand or Accent for a colour, Body or Display for a font. Nothing is applied until you pick one, and the file is never kept.

  • Colours from an image reads a PNG, JPEG, GIF or WebP of up to 8 MB in the browser, refusing one larger than 40 million pixels before decoding it. Mica draws it at most 96 pixels on a side and suggests up to six distinct colours, favouring colours that cover more of the image and colourful ones over greys.
  • Suggestions from CSS reads a stylesheet of up to 256 KB with the browser’s own CSS parser. It suggests colours from any declaration, custom properties included, ranking colours over greys and a custom property named like --brand or --primary first. It suggests font families from font-family and from custom properties named for fonts, keeping only a plain family name. Selectors, at-rules, url() values and every other part of the file are ignored, and the stylesheet is never applied to the page.

Export theme downloads the theme’s MicaTheme JSON, named after the theme, for example harbour-theme.json. Store that file with your host, as Embed Mica in a host application describes. Import theme loads such a file through parseTheme to keep editing it. A file it refuses, for example one whose source was edited by hand so its id no longer matches, shows the reason and changes nothing. An imported theme keeps the tokens it was stored with until you change a field.

Export DTCG downloads the same theme as DTCG 2025.10 JSON ($value and $type), the format Figma variables export to, named harbour-theme.tokens.json. Colours are the sRGB object (colorSpace, components, alpha, hex), fonts are fontFamily, radii are dimension in px, and shadows are shadow. The theme’s source and id travel under $extensions["farm.lola.mica"], so importing that file rebuilds the same theme. Import DTCG reads a file through parseThemeDtcg.

  • A file that carries Mica’s extension is checked exactly as a stored theme: the same value grammar, an id that matches the source, and the contrast floors. A value changed in another tool is kept when it still passes, and refused, with the reason shown in the panel, when it does not. The canvas stays as it was. A token that is not a theme token and that no theme token aliases is refused by name. $description, $deprecated and other tools’ $extensions are accepted but not kept: exporting again drops them.
  • A file without that extension, such as a Figma variables export, never becomes a theme. It suggests colours, plain font families, and a radius when a corner dimension is recognisable, the same way a CSS file does. Nothing is applied until you pick a suggestion, and createTheme builds the theme from the fields. A token Mica cannot hold, such as a 9999px radius, a colour outside sRGB or a font name that is not a plain family, is skipped rather than refused; a file with nothing usable reports that no suggestions were found.
  • Either file is refused, naming the problem, when it is larger than 256,000 characters, is not JSON, mixes a token and a group, uses an unknown $ property, or contains an alias ({group.token}) that is missing, cyclic, or nested more than eight deep. $extends and $ref are refused by name; a group’s $root token is read like any other token. No text in the file is used as CSS.

A theme only names font families. Mica never downloads a font. If the page has loaded the family, the browser uses it; if not, it falls back to the role’s stack (for example, "Inter", "Avenir Next", "Segoe UI", sans-serif). The host decides which fonts exist: self-host the files, or load them from a source your Content Security Policy already allows.

Embed Mica in a host application shows how a host creates a theme, stores it, loads it and passes it to PackSurface. The functions are listed under themes in the runtime API.