DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

How to Test Dark Mode Screenshots in Chromatic

Configure Storybook to render your dark theme, define Chromatic Modes, and review independent dark-mode snapshots and baselines.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To test dark mode in Chromatic, first make Storybook render your application’s dark theme, then define a Chromatic Mode that activates that theme and apply it to the stories you want to compare. Chromatic captures a separate snapshot and maintains a separate baseline for each mode, so dark-mode changes can be reviewed independently from light mode.

1. Make your dark theme render in Storybook

Chromatic captures what Storybook renders; it does not infer or enable your application’s theme on its own. Configure Storybook to activate the same theme class, provider, or other theme mechanism your app uses. Chromatic recommends @storybook/addon-themes as a framework-agnostic option compatible with popular tools.

As an Amazon Associate I earn from qualifying purchases.

For an app whose themes are represented by CSS classes, a preview configuration can look like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
// .storybook/preview.ts
import { withThemeByClassName } from '@storybook/addon-themes';

const preview = {
  decorators: [
    withThemeByClassName({
      themes: { light: 'light', dark: 'dark' },
      defaultTheme: 'light',
    }),
  ],
};
export default preview;

Here, light and dark are the theme names Storybook exposes, while light and dark on the right are the CSS classes applied to the rendered story. Change the classes or use a provider-based decorator to match your application. Check that the dark theme actually affects the story in Storybook before configuring Chromatic.

#1 Best Overall
Sale
Motorola Moto g - 2026 | Unlocked | Made for US 4/128GB | 50MP Camera | Pantone Slipstream, Cellular_Phone
  • Universal unlocked. Compatible with all major U.S. carriers, including Verizon, AT&T, T-Mobile and other prepaid carriers.
  • Super-bright, super-smooth 6.7" display. See your screen clearly even outdoors in sunlight, and enjoy seamless views with a fast-refreshing 120Hz display.*
  • AI-powered camera system. Take stunning photos in any light with the 50MP camera**, look your best with a 32MP selfie cam*****, and capture extreme close-ups.
  • Superfast 5G performance. Unleash your entertainment at 5G speed*** with the MediaTek Dimensity 6300 chipset and up to 12GB of RAM with RAM Boost****.
  • Long-lasting battery + TurboPower charging. Power through day after day with a 5200mAh battery, then get hours of power in just minutes.****

Chromatic’s documented Modes approach supports Storybook 6.0 and later. Adapt imports and configuration to your Storybook version and framework; the modes documentation notes that Storybook 9 uses an options configuration object.

2. Define a mode for each theme

In .storybook/modes.ts, define modes whose theme values match the theme globals configured for Storybook:

// .storybook/modes.ts
export const allModes = {
  light: { theme: 'light' },
  dark: { theme: 'dark' },
} as const;

Mode names identify the named snapshots and their baselines. The theme value tells the Storybook theme setup which global to apply. If these names do not line up with your decorator’s theme configuration, the mode will not represent the intended appearance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

3. Apply modes at the scope that fits your coverage

Set parameters.chromatic.modes at the project, component, or story level. Use a broad scope when most stories need the same theme coverage; use a narrower scope when only selected components or stories are relevant. Chromatic combines modes applied at these levels into a stack, so broad settings and local additions can multiply the snapshots generated for a story.

// Example in a story's parameters
parameters: {
  chromatic: {
    modes: {
      light: allModes.light,
      dark: allModes.dark,
    },
  },
}

For example, a story tested in both the light and dark modes produces two mode-specific snapshots. Before applying modes project-wide, consider how many stories that scope covers and whether each one needs both appearances.

4. Add viewport coverage when it matters

A mode can combine a theme with viewport settings. Choose a theme-only mode when your immediate risk is a dark-theme styling defect. Add viewport conditions when the layout or theme is likely to behave differently at a particular screen size. There is no universal coverage matrix: choose conditions based on how your application selects its theme and where a defect could appear.

Rank #3
Samsung Galaxy A16 5G 128GB Cell Phone, Unlocked Android Smartphone, Large AMOLED Display, Durable Design, Super Fast Charging, Expandable Storage, US Version, 2025, Blue Black (Renewed)
  • Charger NOT Included, 6.7" Super AMOLED FHD+, 90Hz Refresh Rate, 385 ppi, 800 nits (HBM), 1080x2340px, 5000mAh Battery
  • 128GB, 4GB RAM, microSDXC, Exynos 1330 (5nm), Octa-Core, Mali-G68 MP2 or Mali-G57 MC2 GPU
  • Rear Camera: 50MP, f/1.8 (wide) + 5MP, f/2.2 (ultrawide) + 2MP, f/2.4 (macro), LED flash, panorama, HDR; Front Camera: 13MP, f/2.0, Android 14, up to 6 major Android upgrades, One UI 6.1
  • 3G: HSDPA 850/900/1700(AWS)/1900/2100; 4G LTE: 1/2/3/4/5/7/12/13/14/20/25/26/28/29/30/38/39/40/41/48/66/71, 5G: 2/5/25/41/66/71/77/78 SA/NSA/Sub6/mmWave - Nano-SIM + eSIM
  • US Model – Global Connectivity – Compatible with Most GSM Carriers like T-Mobile, AT&T, MetroPCS, etc. Will Also work with CDMA Carriers Such as Verizon, Straight Talk.

Current Modes viewport guidance supports integer widths, width-and-height integer pairs, and integer strings with a px suffix. If you omit the viewport, Chromatic documents a default of 1200 × 900 pixels. Snapshots are cropped to component bounds; set cropToViewport when the capture needs to be constrained to the specified viewport.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Distinguish the app theme from browser color preference

A Storybook theme decorator and the browser’s prefers-color-scheme setting test different mechanisms. The decorator activates your application’s theme context or classes. Chromatic’s browser mode options can set colorScheme to dark or light for UI that responds to the browser preference.

  • Use the theme global when the behavior under test is your app’s explicit theme class, context, or provider.
  • Use colorScheme when the behavior depends on CSS or application logic that reads prefers-color-scheme.
  • Use both when the app responds to browser preference and its components also need explicit theme setup.

6. Run a build and review the dark snapshots

Run your Chromatic build after configuring the Storybook decorator and modes. Chromatic creates a snapshot for each applied mode. Review dark-mode changes against the dark mode’s own baseline and approve them separately from light-mode changes.

Rank #4
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

The mode name is part of baseline identity. Changing viewport or global values while keeping the same name continues comparison against that named mode’s accepted baseline. Renaming a mode creates a new snapshot baseline, so avoid casual renaming if you intend to retain the existing comparison history.

7. Use the current Modes API for viewport testing

chromatic.viewports is a legacy API replaced by Modes. Chromatic warns that the old viewport API and Modes cannot be used simultaneously. If an existing project still uses chromatic.viewports, follow Chromatic’s migration guidance rather than layering the old setting on top of new modes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Run visual tests on demand in Storybook

Chromatic’s Visual Tests addon can run tests on demand from Storybook. Its documented installation command is npx storybook@latest add @chromatic-com/storybook; the addon documentation specifies Storybook 7.6 or later.

Best Value
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.

Or skip the browser setup

If your goal is to capture a URL rather than compare Storybook stories and mode-specific baselines, ScreenshotNeo offers a screenshot API and MCP server. A direct API call can return a screenshot; it does not replace Chromatic’s story-based visual review workflow.

For example, using cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response says which outcome occurred. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.