Add admin HK color customization fields to theme editor
Local Build and Deploy / deploy (push) Successful in 58s
Local Build and Deploy / deploy (push) Successful in 58s
- Add 6 new admin color DB keys (admin_canvas, admin_surface, admin_text, admin_text_muted, admin_border, admin_sidebar_bg) that override the derived admin palette - Extract adminPaletteCss() from themePaletteCss() for reuse - Generate admin CSS variables in both :root and html.dark with overrides - Persist admin color settings via saveTheme action - Add Admin panel (HK) section to /admin/theme with color pickers
This commit is contained in:
1 parent
4dcf6fdce8
commit
a16d9859e8
5 files changed
+134
-57
No files matched your search
@@ -47,6 +47,15 @@ const HEADINGS: { key: string; label: string; def: string }[] = [
|
||||
{ key: "size_heading_h3", label: "H3", def: "18" },
|
||||
];
|
||||
|
||||
const ADMIN_FIELDS: { key: string; label: string; def: string }[] = [
|
||||
{ key: "admin_canvas", label: "Admin canvas", def: "#0f172a" },
|
||||
{ key: "admin_surface", label: "Admin surface", def: "#1e293b" },
|
||||
{ key: "admin_text", label: "Admin text", def: "#f1f5f9" },
|
||||
{ key: "admin_text_muted", label: "Admin muted text", def: "#94a3b8" },
|
||||
{ key: "admin_border", label: "Admin border", def: "#334155" },
|
||||
{ key: "admin_sidebar_bg", label: "Admin sidebar", def: "#0f172a" },
|
||||
];
|
||||
|
||||
const ALL_COLORS = [...COLOR_FIELDS, ...BUTTON_FIELDS, ...GRADIENT_FIELDS];
|
||||
|
||||
function toHex(value: string | null, def: string): string {
|
||||
@@ -92,7 +101,9 @@ export default async function AdminTheme({
|
||||
|
||||
const current = Object.fromEntries(
|
||||
await Promise.all(
|
||||
ALL_COLORS.map(async (f) => [f.key, (await siteSettings.get(f.key, f.def)) ?? f.def] as const),
|
||||
[...ALL_COLORS, ...ADMIN_FIELDS].map(
|
||||
async (f) => [f.key, (await siteSettings.get(f.key, f.def)) ?? f.def] as const,
|
||||
),
|
||||
),
|
||||
) as Record<string, string>;
|
||||
const defaultPreset = PRESETS["Atom (golden)"];
|
||||
@@ -190,6 +201,14 @@ export default async function AdminTheme({
|
||||
<div className="admin-card">{colorGrid(GRADIENT_FIELDS, current)}</div>
|
||||
</section>
|
||||
|
||||
<h2 className="mt-8 text-lg font-extrabold">Admin panel (HK)</h2>
|
||||
<section className="mt-4">
|
||||
<p className="text-xs text-[var(--admin-text-muted)] mb-2">
|
||||
Colors for the Housekeeping admin panel. These override the defaults derived from light/dark mode palettes.
|
||||
</p>
|
||||
<div className="admin-card">{colorGrid(ADMIN_FIELDS, current)}</div>
|
||||
</section>
|
||||
|
||||
<h2 className="mt-8 text-lg font-extrabold">Dark mode</h2>
|
||||
<section className="mt-4">
|
||||
<h3 className="admin-section-title">{t("colours")}</h3>
|
||||
|
||||
Reference in new issue
Block a user