Themes of public pages
A theme sets how a public page looks: its colours, font, corners and buttons. Every organization has the built-in themes branding (the neutral look in the accent colour of the organization’s branding, as it is now), standard (Doxtly’s standard look, the look a page had before themes), neutral, calm, bold, exam and dark, and can make its own in its theme library. Built-in themes can’t be changed or deleted.
Quizzes, surveys, forms and interactive documents pick their theme from this list (their look.themeId or themeId), and every one has a theme. One created without a theme gets the organization’s default theme, branding until you choose another; one saved without a theme keeps the one it has. Responses always carry the theme. Reading the themes needs forms.view, quizzes.view, surveys.view, interactive_documents.view or themes.manage. Creating, changing and deleting them, choosing the default and seeing where one is used need themes.manage (Manage themes).
Before you start
Section titled “Before you start”The overview explains sending requests, and the errors page the errors every endpoint can answer.
A theme’s tokens:
| Field | Type | Meaning |
|---|---|---|
primaryColor |
string | Buttons and headings, #rrggbb. |
accentColor |
string or null | Links, the progress bar and chosen options; null for the primary colour. |
backgroundColor |
string | The page behind the card. |
backgroundGradientTo |
string or null | A second colour the background fades to, top to bottom. |
surfaceColor |
string | The card the questions stand on. |
surfaceOpacity |
number | 0.6 to 1. |
textColor |
string | Must have a contrast of at least 3:1 with surfaceColor. |
fontFamily |
string | system, inter, lato, poppins, ubuntu, carlito, ibm_plex_serif, pt_serif, spectral, caladea or jetbrains_mono. Doxtly serves the fonts itself. |
baseSize |
integer | 16, 18 or 20 pixels. |
radius |
integer | Corners, 0 to 24 pixels. |
buttonStyle |
string | filled, outline or pill. |
optionStyle |
string | list or cards. |
density |
string | compact, comfortable or spacious. |
logoPlacement |
string | left, center or hidden. |
A token left out takes its default, the neutral theme’s.
List themes
Section titled “List themes”GET/v1/public_themes
The built-in themes, then your organization’s by name.
Key permission: get_public_themes (Read themes of public pages)
Response: 200, with items. Each theme has id (a built-in theme’s is its key), name (a built-in theme’s is its key too), builtIn, tokens, updatedAt (null for a built-in theme), standardLook (true when the page keeps its look without a theme and only the CSS is added), customCss (the CSS as its author wrote it; null for none and for a built-in theme) and isDefault (true for the organization’s default theme).
Get a theme
Section titled “Get a theme”GET/v1/public_themes/{id}
One of your organization’s themes.
Key permission: get_public_themes (Read themes of public pages)
Response: 200, with the fields of List themes. 404 when your organization has no theme with this id.
Create a theme
Section titled “Create a theme”POST/v1/public_themes
Key permission: manage_public_themes (Create, change and delete themes of public pages)
Body:
| Field | Type | Meaning |
|---|---|---|
name |
string | Required, up to 100 characters. |
tokens |
object | The look, as in Before you start. |
standardLook |
boolean | true keeps the look a page has without a theme and adds only customCss; the tokens are then not used. Default false. |
customCss |
string or null | CSS for every page shown in the theme, up to 20,000 characters. Default null. See Styling with CSS. |
Response: 201, with the theme. 422 names each field refused, at its path: tokens.textColor for text too hard to read on the card, and customCss, with one message for each reason, for CSS a theme refuses, such as an @import or a url() that isn’t a data: picture or font. The reasons are listed in What saving refuses.
Update a theme
Section titled “Update a theme”PUT/v1/public_themes/{id}
Every page shown in the theme looks the new way from its next opening.
Key permission: manage_public_themes (Create, change and delete themes of public pages)
Body: as for Create a theme. Response: 200, with the theme.
Where a theme is used
Section titled “Where a theme is used”GET/v1/public_themes/{id}/usage
How many forms, quizzes, surveys and interactive documents are shown in one of your themes: what a deletion would move to the default theme.
Key permission: manage_public_themes (Create, change and delete themes of public pages)
Response: 200, with the counts. 404 when your organization has no theme with this id.
{ "forms": 4, "quizzes": 0, "surveys": 1, "interactiveDocuments": 0}Delete a theme
Section titled “Delete a theme”DELETE/v1/public_themes/{id}
The forms, quizzes, surveys and interactive documents shown in it move to the organization’s default theme. If it was the default theme itself, branding becomes the default again and they move there. Where a theme is used tells you how many first.
Key permission: manage_public_themes (Create, change and delete themes of public pages)
Response: 204.
Set the default theme
Section titled “Set the default theme”PUT/v1/public_themes/default
The theme every new form, interactive document, quiz and survey gets when it is created without one, including those made by Doxie, an import or a template. What already has a theme keeps it.
Key permission: manage_public_themes (Create, change and delete themes of public pages)
Body:
| Field | Type | Meaning |
|---|---|---|
themeId |
string | Required: a built-in theme’s key or the id of one of your organization’s themes. |
Response: 200, with the theme, isDefault true. 422 when your organization has no such theme.
{ "themeId": "standard" }In an embed
Section titled “In an embed”GET /v1/public/forms/{token} and GET /v1/public/quizzes/{token}, the public pages of a form, a quiz and a survey, and their POST …/secure with the password take ?_theme= with a theme’s id or a built-in theme’s key: the answer then has that theme’s theme and customCss. Another organization’s theme, or one that doesn’t exist, is ignored, and the page keeps its own. This is how the embed script, the iframe widget and the plugins show another theme on one website.