Skip to content

Commit 10a76d5

Browse files
committed
Support dark theme
1 parent 6be4618 commit 10a76d5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const defaultContext = {
6363

6464
const screenshotParams = z.object({
6565
url: z.string().startsWith("/"),
66+
color: z.enum(["light", "dark"]).default("light"),
6667
headers: z.string().optional(), // JSON object
6768
});
6869
router.get(
@@ -71,6 +72,7 @@ router.get(
7172
const query = await getValidatedQuery(event, screenshotParams.parse);
7273
const context = await browser.newContext({
7374
...defaultContext,
75+
colorScheme: query.color,
7476
extraHTTPHeaders: JSON.parse(query.headers ?? "{}"),
7577
});
7678
const page = await context.newPage();

0 commit comments

Comments
 (0)