Chapter 79
The Application Theme format
An Application Theme styles Pilcrow itself: its light or dark appearance, the accent colour, the sidebar, the status and formatting bars, and the editor. It is a JSON file. Rendered documents (Preview, HTML, PDF, image, print and Word) are styled separately by a Render Theme, which is CSS (Chapter 80). The two kinds are installed, chosen and deleted separately, and neither follows the other.
A complete example#
{
"pilcrowAppTheme": 1,
"name": "Nord",
"appearance": "dark",
"colors": {
"accent": "#88C0D0",
"sidebar": { "background": "#2E3440", "foreground": "#D8DEE9" },
"bars": { "background": "#3B4252", "foreground": "#D8DEE9" },
"editor": {
"background": "#2E3440",
"foreground": "#ECEFF4",
"cursor": "#88C0D0",
"selection": "#434C5E",
"gutterBackground": "#2E3440",
"gutterForeground": "#4C566A"
},
"syntax": {
"heading": "#88C0D0",
"marker": "#EBCB8B",
"code": "#A3BE8C",
"link": "#81A1C1",
"muted": "#7B88A1",
"tokens": { "strong": "#D08770" }
}
}
}
Top level#
| Key | Required | Value |
|---|---|---|
pilcrowAppTheme | yes | The format version, 1. |
name | yes | 1–200 characters. Shown in Settings and the Themes menu. |
appearance | yes | "light", "dark" or "automatic". |
colors | light and dark themes | One palette (below). |
light, dark | automatic themes | Two palettes: one used in the system's light appearance, one in dark. |
id | no | Written by Pilcrow for its own library. Ignored on import, which always assigns a new id. |
appearance decides the appearance of every window: menus, Settings, sheets and pickers included. A light or dark theme fixes it; automatic follows the system.
An automatic theme must set each colour in both light and dark or in neither. A colour set for one appearance only would otherwise be drawn in the other.
Palette#
Every key is optional. A colour left out keeps Pilcrow's built-in look, so a theme can be as small as one accent colour.
| Key | Styles |
|---|---|
accent | The app-wide tint: buttons, selected segments, toggles, links, focus rings, and the sidebar's selected row. Unset keeps the system accent. |
sidebar.background, sidebar.foreground | The Files, Outline and Find sidebar. Secondary labels derive from the foreground. |
bars.background, bars.foreground | The status bar, the docked formatting toolbar, and import notices. Secondary labels derive from the foreground. |
editor.background, editor.foreground | The editor canvas and body text. |
editor.cursor, editor.selection | The insertion point and the selection highlight. |
editor.gutterBackground, editor.gutterForeground | The line-number gutter. The background defaults to the editor background. |
editor.currentLineRule | The thin rule under the line the caret is on, when View ▸ Current-Line Rule is on. Defaults to the editor text colour at low strength. |
syntax.<group> | Live syntax colours by group (below). |
syntax.tokens.<raw> | One token by its raw value, overriding its group. |
Syntax groups#
| Group | Colours |
|---|---|
heading | Headings (markers and text), alert markers, definition terms |
marker | Emphasis, strong, strikethrough and other inline delimiters; list and task markers |
code | Inline code, fenced and indented code blocks, math, HTML blocks |
link | Link and image labels and destinations, autolinks |
muted | Block quote markers, thematic breaks, table rows, comments, block attributes |
codeKeyword, codeString, codeNumber, codeComment | Highlighted code inside a fence |
A group left unset takes a built-in colour chosen for the editor background: darker tones on a light canvas, lighter tones on a dark one. Token names in syntax.tokens use letters, digits, _ and -, and cannot repeat a group name (syntax.heading already covers heading).
Colours#
Every colour is a hex string: #RGB, #RGBA, #RRGGBB or #RRGGBBAA, in sRGB. Pilcrow stores them in upper case.
Validation#
Pilcrow refuses a file rather than ignore part of it, and names the key at fault, for example colors.editor.cursor: must be a hex colour. It refuses:
- a missing or different
pilcrowAppThemeversion; - an unknown key at any level (usually a typo);
- a palette key that does not match the appearance (
colorsin an automatic theme,lightanddarkin a light or dark one); - a colour that is not hex;
- an automatic theme whose
lightanddarkpalettes set different colours.
What an Application Theme does not change#
The window title bar and toolbar (the system's glass, which takes only the accent), menus, Settings, sheets and pickers keep their native look apart from appearance and accent. Fonts are not themed: the editor font and size are set in Settings ▸ Appearance ▸ Text Size & Fonts.
Installing and sharing#
- Import a
.jsonfile from Settings ▸ Library ▸ Themes, File ▸ Import ▸ Theme on the Mac, or Settings ▸ Library ▸ Import on iPad. Dropping the file on Pilcrow works too. - A
.ziptheme package may hold Application Themes beside Render Themes (Chapter 80). - The share button beside a theme saves its
.jsonfile, or the whole package when the theme came from one.
Pilcrow includes three Application Themes: Automatic, Light and Dark. They set the editor and syntax colours and leave the chrome at its built-in look.