shots: app titles get the weights the templates use (variable axis, used range or static weights; font-weight warning), palette.bg as one colour or a CSS gradient string (validated; contrast guard in shots check), photo backgrounds (palette.image, shots.feature.background) with overlay and cover crop

This commit is contained in:
CRTkafa 2026-10-20 13:37:37 +07:00
parent 2ba8278ab7
commit 3a11682a37
21 changed files with 713 additions and 44 deletions

View file

@ -1,5 +1,6 @@
// Pure parts of the screenshot pipeline: store sizes, palettes, per-language script fonts, copy validation, job data.
import { specFamily } from './local-fonts';
import { bgIssue } from './palette';
import type { Palette, ShipConfig, ShotScene, ShotsConfig } from '../lib/config';
/** Store image sizes. ios69 = 6.9" (APP_IPHONE_67), ios65 = 6.5" (APP_IPHONE_65), iphone-medium = 6.3" iPhone with
@ -94,7 +95,11 @@ export const APP_PALETTES: Record<string, Palette> = {
export const palette = (p: string | Palette | undefined, style: 'game' | 'app' = 'game'): Palette => {
const own = style === 'app' ? APP_PALETTES : PALETTES;
if (!p) return style === 'app' ? APP_PALETTES.mist! : PALETTES.fire!;
if (typeof p !== 'string') return p;
if (typeof p !== 'string') {
const bad = bgIssue(p.bg);
if (bad) throw new Error(`${bad} (got ${JSON.stringify(p.bg)})`);
return p;
}
const hit = own[p] ?? PALETTES[p] ?? APP_PALETTES[p];
if (!hit) throw new Error(`unknown palette "${p}" (${Object.keys(own).join(', ')}) or pass { bg, glow, ink, shadow }`);
return hit;