Server themes API
The owner sets the default light and dark theme of the server and offers up to 20 server themes to everyone (Settings → Server → Branding).
Implementation notes
The owner sets the default light and dark theme of the server and offers up to 20 server themes to everyone (Settings → Server → Branding). A member whose choice for a side is empty sees the server default; a member's own choice always wins, and nothing is written to anyone's data. GET /api/v1/auth/status carries "themes": {"version": 3} for a signed-in caller; the version grows with every change, so a device reads the themes again when it differs from the one it has.
- PUT
/api/v1/settings/themes/default - PUT
/api/v1/settings/themes/instance/{id} - DELETE
/api/v1/settings/themes/instance/{id} - GET
/api/v1/themes/instance
PUT /api/v1/settings/themes/default
Update settings themes default · Token or session
Owner. {light, dark}, each "", builtin:<id> or instance:<id> of that side's kind (400 invalid_input for an unknown id or a theme of the other kind; OpenTodo's own theme is stored as ""). Answers like the read; recorded as settings.changed (themes.default.light, themes.default.dark, the ids only)
Only the server's owner.
| Field | Type | Description |
|---|---|---|
dark required | string | |
light required | string |
| Field | Type | Description |
|---|---|---|
default required | object | |
default.dark required | string | |
default.light required | string | |
themes required | array of object | |
themes[].doc required | string | |
themes[].id required | string | |
themes[].kind required | string | |
version required | number |
PUT /api/v1/settings/themes/instance/{id}
Replace a settings themes instance · Token or session
Owner. A theme document as the body, at most 16 KB (413 too_large), valid (400 invalid_input); {id} is new to add one (409 limit_reached past 20) or the id of one to replace (404 not_found). The server sets the document's id. A theme that is a default keeps its kind (400 invalid_input). Answers the read plus the theme's id; recorded as settings.changed (themes.instance, added or changed and the id)
Only the server's owner.
| Field | Type | Description |
|---|---|---|
id required | string | path |
| Field | Type | Description |
|---|---|---|
default required | object | |
default.dark required | string | |
default.light required | string | |
id required | string | |
themes required | array of object | |
themes[].doc required | string | |
themes[].id required | string | |
themes[].kind required | string | |
version required | number |
DELETE /api/v1/settings/themes/instance/{id}
Delete a settings themes instance · Token or session
Owner. Removes the theme and clears a default that names it in the same change (404 not_found for an unknown id). Members who chose it fall back to their side's default and keep their stored choice. Recorded as settings.changed (themes.instance, removed and the id)
Only the server's owner.
| Field | Type | Description |
|---|---|---|
id required | string | path |
| Field | Type | Description |
|---|---|---|
default required | object | |
default.dark required | string | |
default.light required | string | |
themes required | array of object | |
themes[].doc required | string | |
themes[].id required | string | |
themes[].kind required | string | |
version required | number |
GET /api/v1/themes/instance
Get themes instance · Token or session
Signed in (read tokens too). Answers {version, default: {light, dark}, themes: [{id, kind, doc}]}: each default is "" (OpenTodo's), builtin:<id> or instance:<id>; each doc is a theme document (docs/themes.md) whose id is the server id. 401 unauthorized without a session or token
| Field | Type | Description |
|---|---|---|
default required | object | |
default.dark required | string | |
default.light required | string | |
themes required | array of object | |
themes[].doc required | string | |
themes[].id required | string | |
themes[].kind required | string | |
version required | number |