Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/shot_skin.mjs

1.3 KiB, 1 run

created by r2519314175:191, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1import { open, chat } from './harness.mjs';
2import path from 'node:path';
3import { fileURLToPath } from 'node:url';
4// This checkout's own shots directory; an absolute path here is one
5// developer's layout, and dev/ is carved into a public mirror.
6const S = path.join(path.dirname(fileURLToPath(import.meta.url)), 'shots');
7const s = await open({ name: 'skinshot' });
8const { page } = s;
9// Give it a chat so the surface isn't just the empty state.
10await chat(s, 'Hello — can you help me plan a small project?');
11await page.waitForTimeout(500);
12
13async function grab(skin, theme, label) {
14 await page.evaluate(({ skin, theme }) => {
15 window.DaimondSkin.set(skin);
16 if (theme) window.DaimondTheme.set(theme);
17 }, { skin, theme });
18 await page.waitForTimeout(700); // let the webfont + repaint settle
19 await page.screenshot({ path: `${S}/skin_${label}.png`, fullPage: false });
20 console.log('shot', label);
21}
22await grab('sharp', 'dark', 'sharp_dark');
23await grab('warm', 'light', 'warm_light');
24await grab('warm', 'dark', 'warm_dark');
25await grab('sharp', 'light', 'sharp_light');
26// Mobile width
27await page.setViewportSize({ width: 390, height: 780 });
28await page.waitForTimeout(400);
29await grab('warm', 'light', 'warm_light_mobile');
30await grab('sharp', 'dark', 'sharp_dark_mobile');
31await s.close();