Let superadmins change the whole colour palette

Panel -> Site settings -> Colours: any colour token, with a light and a
dark value (migration 041). The server writes the overrides into each
page's head in the same cascade layers as index.css, so a light-only
change leaves dark mode alone. Values must be #rrggbb (a table CHECK),
and saving refuses a palette that puts any text under 4.5:1 in either
mode, through a new descriptor hook, check(db, id), run inside the
save's transaction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 23:26:35 -05:00
parent a225e84408
commit f1edaaf92a
9 changed files with 258 additions and 4 deletions

View file

@ -316,6 +316,7 @@ export function createRow(db, entity, payload) {
writeExtensions(db, entity, newId, payload, values);
writeChildren(db, entity, newId, payload, values);
entity.check?.(db, newId);
}),
);
@ -365,6 +366,9 @@ export function updateRow(db, entity, rawId, payload) {
writeExtensions(db, entity, id, payload, merged);
writeChildren(db, entity, id, payload, merged);
// The descriptor's own rule over the saved result, children
// included. Throwing rolls the whole save back.
entity.check?.(db, id);
}),
);