Colour scheme

Capture the dark version of a page you do not control

A site with a dark theme decides which one to show from a media query. Answering that query is all it takes.

dark_modemedia_typereduced_motionomit_background
curl --fail-with-body "https://api.pagecapture.dev/v1/take" \
  -H "X-Access-Key: $PAGECAPTURE_KEY" \
  -H "Content-Type: application/json" \
  --data '{"url":"https://example.com","format":"jpg","dark_mode":true}' \
  -o capture.jpg

Verified 2026-08-13 by running the published code against a fixture.

Configure it in the playground
What you are seeing

Your product shows previews on a dark background, and every thumbnail comes back in the site's light theme.

Why the page does that

The browser reports a colour-scheme preference, and a fresh automated context reports the default one. Nothing on the page is wrong; it is answering the question it was asked.

What it does

  • Emulates `prefers-color-scheme: dark` for the whole capture, so CSS, images with `<picture>` media conditions and canvas code all see the same answer.
  • Is part of the cache key, so the light and dark captures of one URL are separate entries and never overwrite each other.
  • Works on `/v1/take` and `/v1/animate` alike, because it is a property of the context rather than of the output format.

What it does not do

  • Does not invert a site that has no dark theme. There is no filter here — a light-only page renders light, and that is the honest result.
  • Does not click a theme toggle. A site that stores the choice in localStorage needs `scripts` to seed it.
  • Does not change the media type. Print styles are `media_type`, and the two are independent.
The contract

Every limit on this page is the one the API enforces

These rows are read from the same parameter table that validates your request. Nothing here is transcribed, so a number cannot drift from the behaviour it describes.

ParameterTypeDefaultRangeEndpointsCache key
dark_mode

Emulate `prefers-color-scheme: dark`.

booleanfalse/v1/take, /v1/animateIn
media_type

CSS media type to emulate.

enumscreen/v1/take, /v1/animateIn
reduced_motion

Emulate `prefers-reduced-motion: reduce`.

booleanfalse/v1/take, /v1/animateIn
omit_background

Render with a transparent background where the format supports alpha.

booleanfalse/v1/takeIn
Group: EmulationValues outside a documented range are rejected before a browser opens.

How it behaves next to the rest of the request

media_type

CSS media type to emulate.

`screen` or `print`, independent of the colour scheme. A page can have a dark screen theme and a light print stylesheet, and you can request either combination.

reduced_motion

Emulate `prefers-reduced-motion: reduce`.

The other emulated preference. Together they describe a visitor who wants a dark, still page — usually exactly the visitor a marketing capture should represent.

omit_background

Render with a transparent background where the format supports alpha.

For a transparent capture, the theme still decides the colour of everything that is not the background. Both parameters apply to the same render.

Errors this option can produce

None of them is billable. No error code in the catalog is.

Questions this raises

The page has a dark mode and I still get light. Why?

Its theme is probably stored rather than queried — a cookie, a localStorage key or a class on `<html>`. Set it with `scripts`, or send the cookie the site uses.

Do I need two requests for both themes?

Yes, and they cache separately: `dark_mode` is part of the cache key, so neither result can be served for the other.

Does dark mode work for PDF too?

It applies to the render, so yes — though a page with print styles may drop its dark theme when you also set `media_type=print`.