| 1 | import { type ThemeProperties, type Themes } from "@/lib/presentation/themes"; |
| 2 | import { resolvePresentationThemeData } from "./theme-resolution"; |
| 3 | |
| 4 | export function resolvePresentationImageTheme( |
| 5 | theme: Themes | string, |
| 6 | customThemeData: ThemeProperties | null, |
| 7 | ): ThemeProperties | null { |
| 8 | return resolvePresentationThemeData({ customThemeData, theme }); |
| 9 | } |
| 10 | |
| 11 | export function buildPresentationThemedImagePrompt( |
| 12 | prompt: string, |
| 13 | theme: ThemeProperties | null, |
| 14 | ): string { |
| 15 | const trimmedPrompt = prompt.trim(); |
| 16 | if (!theme) { |
| 17 | return trimmedPrompt; |
| 18 | } |
| 19 | |
| 20 | const { colors, mode, description } = theme; |
| 21 | const paletteParts = [ |
| 22 | colors?.background ? `background ${colors.background}` : null, |
| 23 | colors?.primary ? `primary ${colors.primary}` : null, |
| 24 | colors?.accent ? `accent ${colors.accent}` : null, |
| 25 | colors?.heading ? `highlight ${colors.heading}` : null, |
| 26 | ].filter((part): part is string => Boolean(part)); |
| 27 | const mood = mode === "dark" ? "dark, moody" : "bright, clean"; |
| 28 | const promptParts = [ |
| 29 | trimmedPrompt, |
| 30 | description ? `${description.toLowerCase()} aesthetic` : null, |
| 31 | `${mood} atmosphere`, |
| 32 | paletteParts.length > 0 |
| 33 | ? `color palette: ${paletteParts.join(", ")}` |
| 34 | : null, |
| 35 | ].filter((part): part is string => Boolean(part)); |
| 36 | |
| 37 | return promptParts.join(", "); |
| 38 | } |
| 39 |