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
| 1 | import { open, chat } from './harness.mjs'; |
| 2 | import path from 'node:path'; |
| 3 | import { 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. |
| 6 | const S = path.join(path.dirname(fileURLToPath(import.meta.url)), 'shots'); |
| 7 | const s = await open({ name: 'skinshot' }); |
| 8 | const { page } = s; |
| 9 | // Give it a chat so the surface isn't just the empty state. |
| 10 | await chat(s, 'Hello — can you help me plan a small project?'); |
| 11 | await page.waitForTimeout(500); |
| 12 | |
| 13 | async 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 | } |
| 22 | await grab('sharp', 'dark', 'sharp_dark'); |
| 23 | await grab('warm', 'light', 'warm_light'); |
| 24 | await grab('warm', 'dark', 'warm_dark'); |
| 25 | await grab('sharp', 'light', 'sharp_light'); |
| 26 | // Mobile width |
| 27 | await page.setViewportSize({ width: 390, height: 780 }); |
| 28 | await page.waitForTimeout(400); |
| 29 | await grab('warm', 'light', 'warm_light_mobile'); |
| 30 | await grab('sharp', 'dark', 'sharp_dark_mobile'); |
| 31 | await s.close(); |