Appearance¶
Curio injects live theme tokens into every plugin page and provides an optional stylesheet (/curio/ui/curio.css) and overlay scrollbar helper (/curio/ui/overlay-scroll.js) so plain HTML matches Curio's native UI and active theme.
/curio/ui/curio.js¶
Include /curio/ui/curio.js in every plugin page:
Even without curio.css, curio.js performs six setup tasks:
- Sets active theme tokens on
:rootas CSS custom properties (grouped below). - Sets
color-scheme: dark | lightand toggles.app-dark,.fx-see-through(Mica/Acrylic) and.fx-inactiveon<html>. - Keeps
document.documentElement.langsynced and dispatchescurio-themeandcurio-language. - Sets
data-curio-wheelon<html>to what the wheel does over a picture in Curio's viewer (Settings › Controls):navigate,zoomorscroll, so a viewer page can do the same. - Sets
data-curio-remember-zoomon<html>when Curio's viewer keeps the zoom as it steps to another picture (Settings › Preview › Image viewer › Remember zoom), and removes it when it doesn't. - Leaves root
font-sizeand scrollbars untouched when you bring your own framework or CSS.
Key CSS custom properties injected on :root:
| Category | Variables |
|---|---|
| Surfaces & backgrounds | --bg, --panel, --surface, --surface-2, --surface-3, --grid-item, --viewer-bg |
| Borders | --border, --border-subtle, --border-strong, --float-border, --input-border, --selection-border |
| Text | --text, --text-muted, --text-faint, --grid-caption |
| Accent & controls | --accent, --accent-text, --accent-hover, --accent-subtle, --accent-border, --selection, --hover, --active, --button, --button-hover, --input, --switch-track, --switch-track-hover, --scrollbar |
| Status & ratings | --info, --success, --warning, --danger (plus -{subtle,border} variants for each), --star |
| Scale, fonts & materials | --r, --round, --g, --row, --ui-font, --mono-font, --font-size, --fx-panel, --fx-side, --plugin-* |
/curio/ui/curio.css¶
Link /curio/ui/curio.css to opt into Curio's base styles, root rem font scaling (--font-size), the .curio-kit class and overlay scrollbars:
UI classes¶
curio.css styles semantic HTML elements (h1–h3, p, a, <button>, <input>, <select>, <textarea>, <table>, <hr>) and provides utility and layout classes matching Curio's own windows:
| Class | Role |
|---|---|
.btn, .btn.primary, .btn.text, .btn.small, .icon-btn |
Primary accent, secondary, quiet text, compact and icon buttons |
<label class="check"> |
Styled checkbox row |
.card, .field, .row, .grow, .muted, .faint, .kbd |
Surface cards, inputs, flex rows, subtle text and keycaps |
.chip, .chip.chip-link |
Tag or value chips (clickable chips match Inspector filter chips) |
.curio-page, .curio-page-head, .curio-page-main, .curio-page-side, .curio-page-body, .curio-page-foot |
Window or tab page layout with header, sidebar, scrolling body and action footer |
.curio-section, .curio-row, .curio-toolbar, .curio-sidebar |
Section cards, labeled rows, toolbars and side panels |
Inspector styles¶
Additional classes match Curio's Inspector widgets:
.curio-props: Key/value metadata rows aligned with Curio's Properties widget..curio-progress: Compact progress bar (used by Reader's Book and Series widgets)..curio-select-btn: Dropdown trigger button paired withui.chooseso menus render outside the iframe bounds..curio-thumb: Framed thumbnail tile matching Curio's cover corners.
Theme tokens¶
- Overlay scrollbars: When
curio.cssis linked and the user has Overlay scrollbars enabled,curio.jsloads/curio/ui/overlay-scroll.jsand adds.overlay-scrollso scrollable areas use Curio's zero-width fade-in scrollbars. - Translucent materials: Use
var(--panel),var(--surface),var(--surface-2)andvar(--surface-3)instead of hardcoded hex colors so.fx-see-throughand.fx-inactiveapply as expected. - Corner radius: Multiply base radii by
var(--r)(for examplecalc(6px * var(--r)), where--rscales to0,0.5or1) and usevar(--round)for pills and dots (0pxwhen the user chooses square corners).
curio-theme¶
Whenever the user switches themes or edits theme colors, curio.js updates :root variables first and then dispatches a CustomEvent on window:
window.addEventListener('curio-theme', (e) => {
const { name, dark, tokens } = e.detail
updateCanvasColors(dark, tokens.bg, tokens.accent)
})
curio-language¶
Whenever the display language changes in Settings › General, curio.js updates document.documentElement.lang and dispatches:
Localization¶
- Startup locale: Check
document.documentElement.lang(or(await curio.app.info()).language) on startup to select your page's active locale. - Manifest translations: Translate manifest strings (
name,description, widget/action/filter/tab/window titles and field labels) by shippinglocales/<lang>.jsonbesideplugin.json. Curio falls back toenand then the manifest's literal strings. - Host pickers: Host-rendered pickers (
ui.pickTags,ui.pickFolders,ui.confirm,ui.menu) follow Curio's active language.
theme_variables¶
Plugins can register custom CSS tokens under theme_variables in plugin.json:
- Names: Keys are exposed as
--plugin-<name>(.and_become-, restricted to ASCII letters, digits and-, up to 64 characters). - Sanitization: Values accept only letters, digits, spaces and
# % . , + - * / ( )with balanced parentheses, length up to 200 characters and nourl(. Disallowed values are ignored and logged, and--safe-modeignores plugin theme variables.