Importing the Dark-Mode Version of a Page Into Figma
One import captures one theme. Make the dark theme the file's only state, import at the same width, then pair both frames with Figma variable modes.
Getting the dark theme into Figma
One import captures one theme. To get the dark version of a page into Figma, make dark the only state the saved file can show, then import it at the same width as the light version. You can then pair the two frames with Figma variable modes.
You need a page that has a dark theme, DevTools in Chrome or Firefox, the UnHTML plugin, and, if you want variable modes, a Figma Professional plan or above. Budget about fifteen minutes for a typical marketing page.
Why one import is one theme
A page is converted as it renders, so an import is a snapshot of one state. The same idea applies to breakpoints, as what a single import captures: you get the layout that existed at the width you chose, not every branch of the stylesheet.
Themes work the same way. UnHTML's public pages describe the inputs (a self-contained .html file, a Safari .webarchive, or a scene.json from the open-source CLI), the viewport choice and the local processing. They do not say that the importer emulates prefers-color-scheme or switches a site's theme. So this guide doesn't depend on it. You make the file dark on its own, and the importer just converts what it's given.
How a page decides to be dark
Pages pick a theme in one of three ways. Find out which one yours uses.
The media query
The prefers-color-scheme media feature takes the values light and dark, and it reflects an operating system or browser setting. MDN lists it as widely available across browsers since January 2020. The usual pattern is a light default with a dark override:
body {
background: #ffffff;
color: #111111;
}
@media (prefers-color-scheme: dark) {
body {
background: #121212;
color: #eeeeee;
}
}
color-scheme and the meta tag
The color-scheme property is a different job. web.dev explains that it opts the page into the browser's own dark defaults for form controls, scroll bars, system colors and the canvas background, while prefers-color-scheme controls the appearance you style yourself. Pages that support dark mode properly use both, and often add <meta name="color-scheme" content="dark light"> so the first paint is already in the right scheme.
Class or attribute toggles
Many sites ship a theme switch. Clicking it sets a class or a data attribute on html or body, and the stylesheet keys off that. No media query is involved, and the choice often lives in localStorage, not in the file.
Step 1: Find out which mechanism the page uses
- Open DevTools and search the stylesheets for
prefers-color-scheme. If it appears, the page responds to the system preference. - Use the site's own theme switch, if it has one, and watch the
classordata-attributes onhtmlandbodychange. - Emulate the preference in DevTools to confirm. In Chrome, the Rendering panel has an emulation field for
prefers-color-scheme. Firefox has equivalent buttons in the Page Inspector.
Note the result: media query, toggle, or both. That decides how you capture the file in Step 2.
Step 2: Capture the dark state as the file
The goal is a saved file that is dark no matter who opens it. Our guide to exporting self-contained HTML from Chrome covers the saving itself. What changes here is what you do before and after.
For a toggle page, switch to the dark theme in the browser first, then save. The dark class or attribute is then part of the saved markup, and the stylesheet applies it every time.
For a media query page, edit the saved copy so the dark values are unconditional. Move the declarations out of the @media block and set color-scheme to match:
:root {
color-scheme: dark;
}
body {
background: #121212;
color: #eeeeee;
}
Keep the original light copy untouched. You'll want it for Step 4.
Match the viewport. Import both themes at the same width: Desktop 1440, Mobile 390, or the same custom width. Two imports at different widths cannot be compared layer for layer.
Check before you import. Open the saved file in a browser with the system set to light. If the page is dark there, it will be dark for the converter too. If it flips back to light, a rule still depends on the preference or on a script.
Step 3: Import and check the result
Run the import and name the frame something like Home / Dark. Then check the places where dark themes usually go wrong:
- Text on dark fills. Compare a few headings and body runs against the browser.
- Link colors. The browser's classic link color,
rgb(0, 0, 238), has a contrast ratio of 2.23:1 on black, which fails both WCAG AA and AAA. If the page never overrode it, links will look dim in the import too, and that is the page's fault, not the converter's. - Images with light backgrounds. A logo exported with a white box shows that box on a dark fill.
- Form controls. Their dark look comes from
color-scheme, so confirm the saved file kept that declaration. - Fonts. Fonts that are not installed get substituted (Inter by default), and every swap is logged in the import report.
Mind the layer cap. As of 2026 the free tier allows 500 layers per import, and Pro ($39 one-time per editor) removes the cap. A busy dark page can hit 500 sooner than you'd expect, since shadows and overlays often become layers of their own. UnHTML is not a pixel-exact clone, so keep the live page open beside the frame while you compare.
Step 4: Pair the two imports with variable modes
Now you have two frames, light and dark. You can leave them side by side for review, which is often enough. If you want one frame that flips, use variable modes.
- Create a color variable collection with two modes, Light and Dark. The first column is the default mode.
- Fill it with the page's colors. The article on how to extract the color styles from an import shows how to collect them, and making an imported page responsive with Figma variables covers binding variables to imported layers.
- Bind the fills and text colors on the light frame to those variables.
- Select the frame, open the Appearance section in the right sidebar, click Apply variable mode, and choose the collection's Dark mode.
The Figma Help Center sets two conditions. The frame's nested layers must use at least one variable, and that variable must have more than one mode. Layers left on Auto take the mode of their parent, and if no parent sets one they use the collection's default. Variable modes are available on the Professional plan and above, and the number of modes per collection depends on the plan.
What UnHTML does and does not do about themes
What's documented: UnHTML takes a self-contained .html file, a Safari .webarchive or a CLI scene.json, lets you choose Desktop 1440, Mobile 390 or a custom width, and makes no network requests by default. What isn't documented on its public pages: theme switching and preference emulation. This guide treats both as unknown and works around them by making the file dark itself.
Summary
Make dark the only state in the file, import it at the same width as the light version, and check contrast on text and links. Then pair the frames with variable modes if you want a single frame that switches.
Frequently Asked Questions
Does UnHTML import the dark version of a page automatically?
UnHTML's public pages do not say that it emulates prefers-color-scheme or switches a site's theme, so do not rely on it. It converts the page it is given. Hand it a file whose dark styles apply unconditionally and the layers come out dark.
Why does my import come out light when my browser is in dark mode?
A saved file keeps the page's CSS, not your system setting. If the dark colors sit inside a prefers-color-scheme media query, whatever renders the file decides which branch applies. Making the dark values unconditional removes that dependency.
Can Figma switch one imported frame between light and dark?
Yes, with variable modes. Create a collection with Light and Dark modes, bind the fills to its variables, then use Apply variable mode on the frame. Modes require a Professional plan or above.
Do I need two imports for light and dark?
For a faithful copy of both themes, yes: one import per theme at the same width. You can keep both frames side by side, or rebuild one of them as a variable-driven frame.
Questions
- Does UnHTML import the dark version of a page automatically?
- UnHTML's public pages do not say that it emulates `prefers-color-scheme` or switches a site's theme, so do not rely on it. It converts the page it is given. Hand it a file whose dark styles apply unconditionally and the layers come out dark.
- Why does my import come out light when my browser is in dark mode?
- A saved file keeps the page's CSS, not your system setting. If the dark colors sit inside a `prefers-color-scheme` media query, whatever renders the file decides which branch applies. Making the dark values unconditional removes that dependency.
- Can Figma switch one imported frame between light and dark?
- Yes, with variable modes. Create a collection with Light and Dark modes, bind the fills to its variables, then use Apply variable mode on the frame. Modes require a Professional plan or above.
- Do I need two imports for light and dark?
- For a faithful copy of both themes, yes: one import per theme at the same width. You can keep both frames side by side, or rebuild one of them as a variable-driven frame.