Add more button/navbar colors and gradient mix section to theme editor

This commit is contained in:
openhands committed 2026-07-07 20:04:16 +02:00
1 parent e43a768ce4
commit f386ae2b25
4 files changed
+53 -8

No files matched your search

+21 -4
View File
@@ -24,21 +24,30 @@ const COLOR_FIELDS: { key: string; label: string; def: string }[] = [
];
const BUTTON_FIELDS: { key: string; label: string; def: string }[] = [
{ key: "button_primary_color", label: "Button", def: "#f59e0b" },
{ key: "button_primary_color", label: "Primary button", def: "#f59e0b" },
{ key: "button_text_color", label: "Button text", def: "#1e293b" },
{ key: "button_secondary_color", label: "Secondary", def: "#22c55e" },
{ key: "button_danger_color", label: "Danger", def: "#ef4444" },
{ key: "button_secondary_color", label: "Secondary button", def: "#22c55e" },
{ key: "button_secondary_text_color", label: "Secondary text", def: "#ffffff" },
{ key: "button_danger_color", label: "Danger button", def: "#ef4444" },
{ key: "button_danger_text_color", label: "Danger text", def: "#ffffff" },
{ key: "button_outline_color", label: "Outline button", def: "#eeb425" },
{ key: "button_outline_text_color", label: "Outline text", def: "#1a1a2e" },
{ key: "link_color", label: "Link", def: "#eeb425" },
{ key: "link_hover_color", label: "Link hover", def: "#cf9d15" },
];
const GRADIENT_FIELDS: { key: string; label: string; def: string }[] = [
{ key: "gradient_from", label: "Gradient from", def: "#f59e0b" },
{ key: "gradient_to", label: "Gradient to", def: "#10b981" },
];
const HEADINGS: { key: string; label: string; def: string }[] = [
{ key: "size_heading_h1", label: "H1", def: "30" },
{ key: "size_heading_h2", label: "H2", def: "22" },
{ key: "size_heading_h3", label: "H3", def: "18" },
];
const ALL_COLORS = [...COLOR_FIELDS, ...BUTTON_FIELDS];
const ALL_COLORS = [...COLOR_FIELDS, ...BUTTON_FIELDS, ...GRADIENT_FIELDS];
function toHex(value: string | null, def: string): string {
return value && /^#[0-9a-fA-F]{6}$/.test(value) ? value : def;
@@ -166,6 +175,14 @@ export default async function AdminTheme({
</div>
</section>
<section className="mt-6">
<h2 className="admin-section-title">Gradient mix</h2>
<p className="text-xs text-[var(--color-text-muted)] mb-2">Control the card header and hero background gradients.</p>
<div className="admin-card">
{colorGrid(GRADIENT_FIELDS, current)}
</div>
</section>
<section className="mt-6">
<h2 className="admin-section-title">{t("typographyLayout")}</h2>
<div className="admin-card">