Skip to content

Commit aaeb0d2

Browse files
authored
Drive invitation poster palette from the linked theme's signature colours (#651)
1 parent c2b3e8e commit aaeb0d2

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

  • 41e20f-wedding-table-seating-planner/components

41e20f-wedding-table-seating-planner/components/tsp.gts

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,16 +3677,59 @@ export class TableSeatingPlannerIsolated extends Component<
36773677
// (cardInfo.theme) so the generated artwork follows the same palette and mood
36783678
// as the rest of the planner. Falls back to a tasteful neutral style when no
36793679
// theme is linked.
3680+
// The linked theme's concrete colour values, keyed by CSS variable name
3681+
// (without the leading `--`), parsed from the same computed `:root { … }`
3682+
// block that skins the planner itself. Empty when no theme is linked.
3683+
private themeColors(): Record<string, string> {
3684+
let css = (this.args.model as any)?.cardInfo?.theme?.cssVariables;
3685+
if (!css) return {};
3686+
let block = String(css).match(/:root\s*\{([\s\S]*?)\}/)?.[1] ?? '';
3687+
let out: Record<string, string> = {};
3688+
let re = /--([\w-]+)\s*:\s*([^;]+);/g;
3689+
let m: RegExpExecArray | null;
3690+
while ((m = re.exec(block))) out[m[1]] = m[2].trim();
3691+
return out;
3692+
}
3693+
36803694
private get posterThemeStyle(): string {
36813695
let theme = (this.args.model as any)?.cardInfo?.theme;
36823696
let name = (theme?.title || theme?.cardInfo?.name || '').trim();
36833697
let desc = (theme?.description || theme?.cardInfo?.summary || '').trim();
3684-
if (name || desc) {
3698+
let c = this.themeColors();
3699+
// The poster ground is the theme's signature colour (its primary / chrome
3700+
// hue) so the artwork reads as the theme at a glance — e.g. a red theme
3701+
// yields a red poster. Lettering uses the theme's own on-primary contrast
3702+
// colour; decorative motifs use the accent (metallic) hue.
3703+
let bg = c['primary'] || c['navy'] || c['ink-2'];
3704+
let fg =
3705+
c['primary-foreground'] ||
3706+
c['gold-soft'] ||
3707+
c['navy-ink'] ||
3708+
c['paper'] ||
3709+
c['background'];
3710+
let accent = c['accent'] || c['gold'] || c['acc'];
3711+
if (name || desc || bg) {
36853712
let intro = name
36863713
? `follow the “${name}” theme`
36873714
: 'follow the linked theme';
36883715
let body = desc ? ` — ${desc}` : '';
3689-
return `Visual style: ${intro}${body}. Let this palette and mood govern the whole poster — the background tone, the decorative motifs behind the text, and the lettering colours all come from this theme.`;
3716+
let colorParts: string[] = [];
3717+
if (bg)
3718+
colorParts.push(
3719+
`the poster background MUST be exactly ${bg} — this is the theme's signature colour; fill every pixel edge to edge with it (or a subtle richer/darker tonal variation of it), and never fall back to plain white or cream unless ${bg} itself is that light`,
3720+
);
3721+
if (fg)
3722+
colorParts.push(
3723+
`lettering colour ${fg}, chosen to stay legible on that background`,
3724+
);
3725+
if (accent)
3726+
colorParts.push(`decorative motif and accent colour ${accent}`);
3727+
let colorLine = colorParts.length
3728+
? ` Use this EXACT colour palette, do not substitute other colours: ${colorParts.join(
3729+
'; ',
3730+
)}.`
3731+
: '';
3732+
return `Visual style: ${intro}${body}. Let this palette and mood govern the whole poster — the saturated background ground, the decorative motifs behind the text, and the lettering colours all come from this theme.${colorLine}`;
36903733
}
36913734
return 'Background: warm white — a soft, warm-toned white like fine letterpress stationery, with a delicate faded decorative motif behind the text (light watercolor florals or fine line-art) in muted, low-contrast tones so the lettering stays crisp and dominant.';
36923735
}

0 commit comments

Comments
 (0)