Change a brand's theme
const url = 'http://localhost:3000/api/v1/brands/example/theme';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"accent":"example","accentUse":"fill","surface":"example","panel":"example","dark":"example","ink":"example","muted":"example","head":"example","body":"example","label":"example","logo":"example","device":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","radius":1,"width":"narrow","density":"compact","scale":1,"nav":"sidebar","band":true,"header":"plain","separation":"space","numbering":true,"motion":"none","toc":"side","titles":"medium","grounds":"plain","languages":[{"code":"example","label":"example","dir":"ltr"}],"links":[{"label":"example","url":"https://example.com"}],"look":"documentation"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url http://localhost:3000/api/v1/brands/example/theme \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "accent": "example", "accentUse": "fill", "surface": "example", "panel": "example", "dark": "example", "ink": "example", "muted": "example", "head": "example", "body": "example", "label": "example", "logo": "example", "device": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "radius": 1, "width": "narrow", "density": "compact", "scale": 1, "nav": "sidebar", "band": true, "header": "plain", "separation": "space", "numbering": true, "motion": "none", "toc": "side", "titles": "medium", "grounds": "plain", "languages": [ { "code": "example", "label": "example", "dir": "ltr" } ], "links": [ { "label": "example", "url": "https://example.com" } ], "look": "documentation" }'Merges: a key left out keeps its value, null clears it. A color setting names a color rule, a font setting a font rule, logo a rule with a picture and device an image asset: a 422 names each that doesn’t, with its path. Answers with the look and its checks, as GET does. A draft in the brand’s history until it is published.
Scope: write.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Brand slug
Request Bodyrequired
Section titled “Request Bodyrequired”object
The languages readers pick from; the first is the one the pages are written in
object
From the language when left out
Links beside search and print on the brand’s pages: its repository, its Figma library, its site
object
Http or https; a link to GitHub, Figma, npm and the like shows its icon
A look sets the layout at once (documentation: dense, quiet, easy to scan; editorial: a book: airy, numbered, big titles; swiss: grid, hairlines, no corners, headlines; bold: every chapter opens on the brand color; cinematic: pictures first, dark, wide, airy; playful: round, warm, alternating grounds; board: a band of the brand color, then a dotted canvas); keys named beside it win
Responses
Section titled “Responses”The theme
object
object
Which rule plays which part, and the page’s measure, rhythm and chrome; left out: read from the rules
object
Hairline: the accent draws rules and marks, never fills
Corner radius in px
Heading size ratio; 1.25 when left out
Every page opens on a band of the brand color; header band says the same
A page’s opening: on the page, on a band of the brand color, or beside its cover
Between two sections on the page’s own ground: space alone, or a hairline too
Number chapters and pages: 01, 01.2
Subtle: sections reveal as they scroll in; never with reduced motion
On this page: a side column, a list under the page header, or hidden
Section titles: headings (medium), or headlines (large, huge); a section’s own size wins
Alternate: every other section on the page’s own ground sits on the panel, so a long page has rhythm; canvas: under its header the page sits on the panel, dotted like a whiteboard, its section titles centered
The languages readers pick from; the first is the one the pages are written in
object
From the language when left out
Links beside search and print on the brand’s pages: its repository, its Figma library, its site
object
Http or https; a link to GitHub, Figma, npm and the like shows its icon
The look the settings and rules give: grounds, inks, accent, faces and chrome
object
The accent, lifted for light and dark pages, and the faces, as before W3
object
A hex color
A hex color
A hex color
A hex color
A hex color
A hex color
The fill, as the brand has it: bands and buttons
The accent where it is text (links), at 4.5:1 on the surface
A hex color
A hex color
object
object
The font file for its weight
Every font file of the rule, one @font-face each
object
From Google Fonts, with no files here yet: set in its fallback until they are imported
object
The font file for its weight
Every font file of the rule, one @font-face each
object
From Google Fonts, with no files here yet: set in its fallback until they are imported
object
The font file for its weight
Every font file of the rule, one @font-face each
object
From Google Fonts, with no files here yet: set in its fallback until they are imported
In em
Header is band
On this page: a side column, a list under the page header, or none
Contrast of each pair in the look: one that fails falls back to a color that reads, and says which
object
Which color on which, e.g. ink on surface
The contrast it must reach: 4.5 for text, 3 for marks
The color used: fg when it passes, else its fallback
Contrast of each pair in the look: one that fails falls back to a color that reads, and says which
object
Which color on which, e.g. ink on surface
The contrast it must reach: 4.5 for text, 3 for marks
The color used: fg when it passes, else its fallback
Settings naming a rule that has gone since (the default is used), and each pair that fell back
Example
{ "data": { "settings": { "accentUse": "fill", "width": "narrow", "density": "compact", "nav": "sidebar", "header": "plain", "separation": "space", "motion": "none", "toc": "side", "titles": "medium", "grounds": "plain", "languages": [ { "dir": "ltr" } ] }, "theme": { "accentUse": "fill", "faces": { "head": { "google": true }, "body": { "google": true }, "label": { "google": true } }, "width": "narrow", "density": "compact", "nav": "sidebar", "header": "plain", "separation": "space", "motion": "none", "toc": "side" } }}default
Section titled “default”An error
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "detail": "example" }}