Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

feat(confirm-ui): add custom color input

hugohe3905e7b483f09
diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.js
index 412fc36e..e94b521c 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/app.js
+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js
@@ -55,6 +55,8 @@
body_size_hint_canvas: "This canvas suggests ~{lo}–{hi}px (scales with canvas height).",
custom_typography: "Custom typography",
custom_typography_placeholder: "Type your font plan, e.g. Heading: Georgia + KaiTi; Body: Microsoft YaHei + Arial…",
+ custom_color: "Custom color",
+ custom_color_placeholder: "Describe your colors in words, e.g. deep navy primary, warm orange accent, white background — or paste HEX values…",
role_background: "bg",
role_secondary_bg: "2nd bg",
role_primary: "primary",
@@ -121,6 +123,8 @@
body_size_hint_canvas: "当前画布建议 ~{lo}–{hi}px(随画布高度缩放)。",
custom_typography: "自定义字体方案",
custom_typography_placeholder: "输入字体方案,如:标题用楷体;正文用微软雅黑…",
+ custom_color: "自定义配色",
+ custom_color_placeholder: "用文字描述配色,如:深蓝主色、暖橙强调、白色背景——或直接粘贴 HEX 值…",
role_background: "背景",
role_secondary_bg: "次级背景",
role_primary: "主色",
@@ -559,15 +563,31 @@
if (hexSwatches[role]) paintSwatch(hexSwatches[role], pal[role]);
});
}
+ var customInput = el("textarea", "text-input custom-color-input");
+ customInput.rows = 2;
+ customInput.placeholder = t("custom_color_placeholder");
+ customInput.style.display = "none";
+
function selectCard(idx) {
var c = cands[idx] || {};
selectedIdx = idx;
STATE.color = { name: c.name || "", palette: Object.assign({}, normPalette(c)) };
grid.querySelectorAll(".color-card").forEach(function (card, i) { card.classList.toggle("selected", i === idx); });
+ customInput.style.display = "none";
applyHexInputs(STATE.color.palette);
refreshStylePreview();
}
+ function selectCustomColor() {
+ selectedIdx = -1;
+ STATE.color = { name: "custom", custom: customInput.value || "", palette: {} };
+ grid.querySelectorAll(".color-card").forEach(function (card) { card.classList.remove("selected"); });
+ customCard.classList.add("selected");
+ customInput.style.display = "block";
+ customInput.focus();
+ refreshStylePreview();
+ }
+
cands.forEach(function (c, idx) {
var pal = normPalette(c);
var refs = {};
@@ -588,7 +608,17 @@
card.addEventListener("click", function () { selectCard(idx); });
grid.appendChild(card);
});
+ var customCard = el("div", "color-card color-card-custom");
+ customCard.appendChild(el("div", "color-name", t("custom_color")));
+ customCard.addEventListener("click", selectCustomColor);
+ grid.appendChild(customCard);
sec.appendChild(grid);
+ customInput.addEventListener("input", function () {
+ if (!STATE.color || STATE.color.name !== "custom") selectCustomColor();
+ STATE.color.custom = customInput.value;
+ refreshStylePreview();
+ });
+ sec.appendChild(customInput);
var override = el("div", "hex-override");
override.appendChild(el("div", "subfield-label", t("hex_override")));
@@ -622,9 +652,17 @@
host.appendChild(sec);
var selIdx = -1;
- if (STATE.color && STATE.color.name) cands.forEach(function (c, i) { if (c.name === STATE.color.name) selIdx = i; });
- if (selIdx >= 0) selectCard(selIdx);
- else applyHexInputs((STATE.color && STATE.color.palette) || {});
+ if (STATE.color && STATE.color.name && STATE.color.name !== "custom") {
+ cands.forEach(function (c, i) { if (c.name === STATE.color.name) selIdx = i; });
+ }
+ if (STATE.color && STATE.color.name === "custom") {
+ customInput.value = STATE.color.custom || "";
+ selectCustomColor();
+ } else if (selIdx >= 0) {
+ selectCard(selIdx);
+ } else {
+ applyHexInputs((STATE.color && STATE.color.palette) || {});
+ }
}
function renderIcons(host) {
diff --git a/skills/ppt-master/scripts/confirm_ui/static/style.css b/skills/ppt-master/scripts/confirm_ui/static/style.css
index b06b7768..20dde656 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/style.css
+++ b/skills/ppt-master/scripts/confirm_ui/static/style.css
@@ -174,6 +174,7 @@ body {
.font-sample-heading { font-size: 24px; font-weight: 700; line-height: 1.3; }
.font-sample-body { font-size: 14px; color: #333; margin-top: 4px; }
.custom-typography-input { margin-top: 8px; min-height: 58px; resize: vertical; }
+.custom-color-input { margin-top: 8px; min-height: 58px; resize: vertical; }
.font-size-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.font-size-input { width: 96px; }
diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.md
index 939117b4..57de82a1 100644
--- a/skills/ppt-master/scripts/docs/confirm_ui.md
+++ b/skills/ppt-master/scripts/docs/confirm_ui.md
@@ -106,7 +106,7 @@ Both files live under `<project_path>/confirm_ui/`.
- `recommend.*` names the recommended `id` for each enumerable field (must match a `catalogs.json` id, or be a free string for a recommended custom value). The page badges and pre-selects it. **Guarantee**: if a `recommend.*` is omitted, the page falls back to the first catalog option so every enumerable field always shows one badged recommendation — but the AI should still set them for a meaningful default. Legacy aliases are accepted for old files (`line` → `tabler-outline`, `filled` → `tabler-filled`, `monochrome` → `chunk-filled`, `search` → `web`, `default` → `auto`, `builtin` → `host-native`), but new files should write canonical ids. For `recommend.image_usage`, do not write bare `"custom"`; if several image sources are mixed, write the concrete prose plan directly, such as `"封面用 AI 生成,产品页用用户素材,行业页用网络来源"` / `"AI cover + user product assets + web industry images"`.
- When `recommend.image_usage` is `ai` or a custom plan that includes AI, also set `recommend.image_ai_path` to one of `auto` / `api` / `host-native` / `manual`; the page presents these as explicit choices.
- For a custom image plan, the page treats "may include AI" as true only when the recommendation includes `recommend.image_ai_path` or `image_strategy.candidates`; a custom plan without those signals is handled as non-AI and omits AI controls / fields.
-- **Color candidates carry the user-facing core `palette`**: `background`, `secondary_bg`, `primary`, `accent`, `secondary_accent`, and `body_text`. The page renders labelled swatches and offers per-role override inputs. Legacy `text` is accepted as an alias for `body_text`, but new files should write `body_text`. Strategist derives secondary text, borders, state colors, and visual-style neutral tiers later when writing `design_spec.md` / `spec_lock.md`; those are not user-facing confirmation choices.
+- **Color candidates carry the user-facing core `palette`**: `background`, `secondary_bg`, `primary`, `accent`, `secondary_accent`, and `body_text`. The page renders labelled swatches and offers per-role override inputs for precise single-role edits, plus a **Custom color card with a free-text box** (parallel to the custom typography box) — the user can describe the palette in words or paste HEX values instead of filling each role; this writes `color: { "name": "custom", "custom": "<text>" }` to `result.json` for the AI to interpret. Legacy `text` is accepted as an alias for `body_text`, but new files should write `body_text`. Strategist derives secondary text, borders, state colors, and visual-style neutral tiers later when writing `design_spec.md` / `spec_lock.md`; those are not user-facing confirmation choices.
- **Candidate display text may be bilingual**: color / typography candidates can provide `name_zh` / `name_en` and `note_zh` / `note_en`; the page falls back to legacy `name` / `note`.
- **Typography candidates split CJK and Latin** for both `heading` and `body`; `css` is the fallback preview `font-family` stack. The page previews CJK sample text with `cjk + css` and Latin sample text with `latin + css`, so the two script choices are visible independently. Each candidate should also include `body_size` (the body baseline in px; common values are 18 and 24, but any reasonable integer is valid). The page exposes `body_size` as an editable numeric field whose hint shows a canvas-appropriate range (≈2.5–3.3% of the confirmed canvas height, parsed from the canvas `dim`), updated when the canvas changes — a hint only, never an override, so a 16:9 default is not silently kept on a tall canvas (Xiaohongshu / Story / A4). It also offers a custom typography text box so the user is not limited to the proposed candidates.
- **Combined style preview** — a compact live "overall impression" strip sits just above the color section and is **sticky**: it pins under the topbar so it stays visible while the user scrolls through the color / icon / typography sections, keeping the picking controls and their combined effect on screen together. It applies the currently selected color palette **and** typography (heading sample in `primary` over `background`, body sample in `body_text`, an `accent` bar, a `secondary_bg` chip) and repaints on every color / HEX-override / font / `body_size` change. It does not replace the per-candidate swatches or font samples (those stay for picking); it is deliberately an abstract style chip, **not** a slide-layout preview — page layout preview remains the live-preview server's job (Step 6). No schema field; it derives entirely from the existing color + typography selections.