← Back
import { chromium } from 'playwright';
const b = await chromium.launch({ executablePath:'/usr/bin/chromium-browser', args:['--no-sandbox'] });
async function shot(theme, accent, file){
  const ctx = await b.newContext({ viewport:{ width:390, height:1400 }, deviceScaleFactor:1.5, serviceWorkers:'block' });
  await ctx.addInitScript(([t,a])=>{ localStorage.setItem('sz_theme',t); localStorage.setItem('sz_accent',a); },[theme,accent]);
  const p = await ctx.newPage();
  await p.goto('https://poly-dev.szhub.space/', { waitUntil:'domcontentloaded', timeout:35000 });
  await p.waitForTimeout(5500);
  await p.screenshot({ path:file });
  const bg = await p.evaluate(()=>getComputedStyle(document.querySelector('.pk-leaders')).backgroundColor);
  await ctx.close();
  console.log(theme, accent, '-> pk-leaders bg:', bg);
}
await shot('light','green','_t_light.png');
await shot('dark','green','_t_dark.png');
await shot('dark','crimson','_t_crimson.png');
await b.close();