Your own colours
Merlive has no themes to pick from. Once for a project, it reads the site your diagrams will be read on and writes the design itself. You never type a colour code. Why it works this way.
Setup runs itself
The first time your agent draws a diagram in a project, it runs setup without asking:
node skills/merlive/scripts/merlive.mjs --setup
It finds the project's own stylesheet, or the site named in package.json. To read another site, the one your diagrams will really be read on, give its address:
node skills/merlive/scripts/merlive.mjs --setup --from https://your.site
This is what it printed when it read this site's stylesheet:
read assets/site.css
found: page #ffffff, text #000000, accent #ffc400, face 'Atkinson Hyperlegible Next Variable', code in 'Atkinson Hyperlegible Mono Variable', in light and dark
changed: accent #ffc400 is 1.6 to 1 on the light page, too close to it for a line; using #b38900, the same hue made to stand out
made by Merlive: a box's fill and edge, lines and quiet text, from your page and text colours
made by Merlive: the colours for kinds of box (decision, rework and the rest) are Merlive's, held to your page
wrote merlive.design.json
Three things happened, and it says each. It found what the site sets. It changed one colour that would have broken a rule, and said which and why. It made what a diagram needs and a site does not have. Every diagram on these pages is drawn in that design.
It also writes diagrams/merlive-setup.html: one of your own diagrams in those colours, in light and dark, with every choice there is.
You can see it work without installing anything: Try it has "In your own colours", where you paste a stylesheet and Merlive says what it read.
What setup reads
--setup looks, in this order, at: the site, stylesheet or folder of stylesheets named with --from; the folder of the project's own stylesheet with the most to say (any .css up to five folders down, leaving out what was installed or built), all of its sheets read together; the homepage in package.json, unless it is where the code lives (GitHub and the like). From a site's address it reads the page, the stylesheets it links to and the styles written in it.
| It looks for | Where |
|---|---|
| Page and text colours | What body sets, following var(); else tokens named like --bg, --background, --paper, --text, --foreground, --ink |
| Accent | The colour of links when it is a colour; else a token named like --accent, --primary, --brand, --mark; else the strongest colour among the tokens |
| Dark mode | The same, inside prefers-color-scheme: dark, .dark or [data-theme="dark"] |
| Face, corner and shadows | body's font-family; the most common border-radius; whether anything has a box-shadow |
| The face for code | The font-family of code, pre, kbd or samp, following var(); it is made to end in monospace |
Colours are read as hex, rgb(), hsl(), bare H S% L% and oklch(). What a diagram needs and a site does not have (a box's fill and edge, lines, quiet text, the colours of kinds) is made from the page and text colours and held to both colour rules. A site with one look gets diagrams with one look. Nothing found is never guessed: the script says so and draws in Merlive's own look.
It does not yet read colours kept only in a Tailwind config, in a component's own <style>, or set by script.
Two rules hold any colours to account
Whether setup read them or you set them by hand, colours pass two rules before a diagram is drawn in them.
- D1. Words and lines can be read against what is behind them.
- D2. Kinds of box can be told apart, also by the one man in twelve who does not see red and green apart.
A design that fails one is refused, and the message names the colour to change. Both rules, with what passes and fails.
What is yours to choose
Colours are read, not asked for. What is left is taste, and your agent offers these once, after setup, with setup's own choice as the recommendation. Say what you want in your own words ("dark only", "no steps", "a picture for the wiki as well"), and it changes the file.
| You want | It changes |
|---|---|
| Light only, dark only, or both | modes |
| Nothing moving, or more | motion: none, calm, lively |
| More character, or less: shadows, a dotted ground | depth: flat, soft. ground: plain, dots |
| A still picture as well as, or in place of, the page | output.format: html, svg, both |
| No walkthrough, no legend, no Mermaid shown | output.steps, output.legend, output.source |
| Another colour, face or corner | light, dark, font, mono, radius |
The design file
merlive.design.json in the project's folder. --setup writes it from the project's own site, so most projects never write one by hand. Everything in it is optional, and what is left out comes from Merlive's own look.
{
"name": "storm",
"from": "src/styles/global.css",
"modes": "both",
"motion": "calm",
"depth": "soft",
"ground": "dots",
"output": { "format": "html", "steps": true, "legend": true, "source": true },
"font": "\"IBM Plex Sans\", system-ui, sans-serif",
"mono": "\"IBM Plex Mono\", ui-monospace, monospace",
"weight": 500,
"radius": 6,
"light": {
"bg": "#f4f6fa",
"node": "#ffffff",
"stroke": "#c3cad5",
"text": "#18202b",
"muted": "#566070",
"edge": "#7a8696",
"accent": "#0a5cc2",
"kinds": { "decision": "#b87a00", "rework": "#a8327a", "vendor": "#5a4fcf" }
},
"dark": { "bg": "#11141a", "node": "#1a1f27", "text": "#eceef2" }
}
| Choice | What it sets |
|---|---|
modes | light, dark or both (follow the reader's system). dark and both need dark colours |
motion | none: nothing moves. calm: one dot follows a path when the reader presses play. lively: the path flows too |
depth | flat: boxes lie on the page. soft: a shadow lifts them off it. Setup follows the site: soft only where the site has shadows |
ground | plain: the page as it is. dots: the grid the boxes are placed on, shown faintly. Setup leaves a site's page plain |
output.format | What is written for each diagram: html (a live page), svg (a still picture) or both |
output.steps | Whether a page carries the walkthrough, when the diagram has %% step lines |
output.legend | Whether a page carries the legend of kinds of box |
output.source | Whether a page carries the Mermaid it was drawn from |
font, weight, radius | The face (a list of faces), its weight (100 to 900) and a box's corner in px (0 to 40) |
mono | The face for code (a list of faces): the Mermaid a page shows, and the rows a class lists. An entity's table keeps the page's face, which its columns are measured for, and so does what a kanban card lists (its ticket, who has it, its priority), which is said in words and is not code |
from | Where setup read the colours. Not used in drawing; it says where to look again |
| Colour | What it is |
|---|---|
bg | The page behind the drawing |
node, stroke | A plain box's fill and its edge |
text, muted | Words, and quieter words (link labels, the legend) |
edge | A line |
accent | The picked thing and the path being shown |
kinds | A colour for each kind of box that means something |
- Colours are six-digit hex. A colour that is not is refused, with its name.
kindsnames are yours: any name used in aclassline can have a colour. A box's edge is its kind's colour, and its fill is that colour thinned intonode. Merlive's own kinds aredecision,terminal(a start or end),rework,external,dataandrisk.- Light and dark. A file that sets
lightand nodarkgives one look whatever the reader's system asks for. Givedarktoo for both. A file that touches no colour (onlyradius, say) keeps Merlive's light and dark. fontis a CSS font stack. The page fetches nothing, so name faces the reader is likely to have, and end with a system face.motion:none,calmorlively.--checkholds the file to two rules before anything is drawn: D1, words and lines can be read, and D2, the kinds can be told apart, also by people who do not see red and green apart. The message names the colour.
Written from site/pages/design.md in the repository, so the two cannot disagree.
Before: Notes, steps and the main pathNext: The placement rules