Files
jason.woltje 7fdb488270 Themes as installed plugins, chosen per organization (S4, plan C5)
Add a reviewed `theme` plugin kind (interfaceVersion 1, export `theme`, switch
"list"). A module returns data only: a displayName and a flat map of colour
custom properties for light, dim and dark. checkTheme validates names and
#rrggbb colours strictly and checks each text/background pair for contrast; a
bad module is refused and logged, never served.

The ten shipped palettes become the first ten modules under
packages/plugins/theme/<name>/. Modules are found by directory scan
(loader.discoverModules, loader.loadInstalled), not by a list in the Console.
loadModule and createLoader are unchanged.

The organization file takes `appearance: { theme, mode }`, validated in
packages/business/src/appearance.mjs; a missing appearance is valid.
GET /api/themes (themes-http.mjs) serves the installed, valid themes.

Browser: the Settings picker lists /api/themes. Precedence is a per-organization
browser override, then the organization's saved theme, then the built-in default
(Harbor, dark). Clearing the override restores the organization's choice. An
uninstalled or invalid saved theme renders the default with a visible warning
and keeps the saved value. A legacy global browser preference is not copied to
every organization. The organization is named in text, so colour is never the
only cue. A plain load writes no appearance record. The default look is
unchanged: computed styles match the base commit element for element.
2026-11-07 12:18:43 -06:00

60 lines
1.7 KiB
JavaScript

// Cobalt: complementary. A stronger royal blue meets a small amber accent. The high hue separation is controlled by using amber only in secondary details.
// Same values as docs/design/tokens.json; the theme test pins them to it.
export const interfaceVersion = 1;
export function theme() {
return {
displayName: "Cobalt",
tokens: {
light: {
"--canvas": "#f3f3f7",
"--surface": "#ffffff",
"--raised": "#e6e8ef",
"--line": "#cdd1df",
"--border": "#63687e",
"--text": "#454a5e",
"--muted": "#60657b",
"--action": "#1c3bc4",
"--onAction": "#ffffff",
"--accent": "#79671b",
"--focus": "#1c3bc4",
"--success": "#277255",
"--warning": "#8f5c19",
"--danger": "#ba2e26",
},
dim: {
"--canvas": "#242838",
"--surface": "#2e3248",
"--raised": "#383d57",
"--line": "#464d6d",
"--border": "#a4a7b7",
"--text": "#d0d2dc",
"--muted": "#a6aab9",
"--action": "#94a5f0",
"--onAction": "#10141a",
"--accent": "#e1ce7a",
"--focus": "#94a5f0",
"--success": "#85d5b7",
"--warning": "#e7b574",
"--danger": "#e89591",
},
dark: {
"--canvas": "#12141c",
"--surface": "#1c1f2c",
"--raised": "#282c3e",
"--line": "#383d57",
"--border": "#a4a7b7",
"--text": "#b6b9c9",
"--muted": "#a4a7b7",
"--action": "#798eec",
"--onAction": "#10141a",
"--accent": "#e1ce7a",
"--focus": "#798eec",
"--success": "#85d5b7",
"--warning": "#e7b574",
"--danger": "#e37d78",
},
},
};
}