prefers‑color‑scheme Live Preview - Online Dark/Light
Toggle between light and dark mode for a demo page. See how to use the media query. Copy the pattern.
UD5 Toolkit
Simulate Windows High Contrast Mode & preview how your UI components render under forced-colors: active.
No system settings change required — compare normal vs. forced-colors side-by-side.
forced-color-adjust: none preserves specific elements •
Links get a distinct forced color (often yellow/blue) • Disabled elements use GrayText
forced-colors is a CSS media feature that detects when the user has enabled a forced color scheme on their operating system — most commonly Windows High Contrast Mode. When forced-colors: active, the browser aggressively overrides author-defined colors with system-defined colors (like Canvas, CanvasText, LinkText, etc.) to ensure readability for users with visual impairments. This affects background colors, text colors, borders, box-shadows, and even SVG fills.
<button>, <input>, and <a> automatically receive appropriate system colors, but custom-styled <div>-based buttons may not adapt correctly.
Canvas (page background), CanvasText (page text), LinkText (unvisited links), ButtonFace (button backgrounds), ButtonText (button text), Field (input backgrounds), Highlight (selection background), GrayText (disabled text), and Mark (highlighted text background). Using these keywords in your CSS helps your site adapt gracefully to forced-colors mode without extra effort. View the reference table above for a complete mapping.
forced-color-adjust: none tells the browser not to override colors on a specific element (or its subtree). Use it sparingly — only for elements that must retain their original colors to be functional, such as: brand logos, color-coded data visualizations, product swatches, or photo galleries. .brand-logo { forced-color-adjust: none; } — this preserves your logo's exact brand color even in high contrast mode. The default value is auto, which allows the browser to adjust colors. There's also preserve-parent-color for inheriting the parent's forced-color adjustment state.
prefers-contrast detects the user's contrast preference (high, low, or no-preference) and can be used to proactively enhance contrast. forced-colors detects when the OS is forcefully overriding all colors. They often overlap — if forced-colors: active is true, prefers-contrast: high is also typically true. However, prefers-contrast: high can be set independently (e.g., on macOS via Accessibility settings) without forced-colors being active. Use prefers-contrast to voluntarily increase contrast; use forced-colors to detect when the OS takes full control.
forced-colors: active. color, background-color, border-color, outline-color, text-decoration-color, text-shadow, box-shadow, caret-color, column-rule-color, and scrollbar-color (in Firefox). Background images are also removed. SVG fill and stroke may be adjusted. Properties like opacity, transform, display, position, and layout-related properties remain unaffected.
<div> or <span> elements with custom CSS (instead of semantic <button> elements), the browser may not recognize them as buttons and won't apply ButtonFace/ButtonText system colors. Always use semantic HTML: <button>, <a>, <input>, <select>. If you must use a <div>, add role="button" and ensure proper system color keywords are used in your CSS.
forced-colors media queries only apply to screen rendering when the OS-level high contrast setting is active. Print stylesheets use the @media print query and are unaffected by forced-colors mode. However, if your print styles rely on the same system color keywords, they will render with the printer's default color handling (which is typically not high contrast).
prefers-color-scheme: dark) is a user preference for a dark color scheme that still respects author styles. Forced-colors mode is an accessibility override where the OS takes full control of colors, replacing them with a strict limited palette (usually black/white + 1 accent color). Dark mode still allows rich color palettes; forced-colors flattens everything to maximum contrast.
Use <button> not <div> for clickable elements. Semantic elements automatically receive correct system colors in forced-colors mode.
Since box-shadows vanish in forced-colors, rely on borders or outlines for visual separation between components.
Use currentColor for SVG fills/strokes — it automatically maps to CanvasText in forced-colors mode.
Toggle between light and dark mode for a demo page. See how to use the media query. Copy the pattern.
Start from a base color and use `oklch(from color l c h)` to create lighter or darker variants. Copy the code.
See how a full paragraph looks with your chosen text and background colors. Not just a ratio; the real appearance.
Simulate reduced motion preference and test your animations. Copy the media query snippet. Keep your users safe.
Generate a palette of N colors that are maximally distinguishable for common color vision deficiencies. Copy the hex codes.
Stack multiple background images and blend them with colors. Create unique textures. Copy the CSS code instantly.
Apply content‑visibility: auto to off‑screen sections and see the rendering cost drop. Demos for infinite scroll optimization.
View a series of digital Ishihara‑style plates. Not a diagnostic tool, just educational. Read numbers.
Test overscroll‑behavior: contain to prevent background scroll or pull‑to‑refresh. See the effect in a live demo.
Enter a URL and get a quick simulation of First Contentful Paint, LCP, and CLS using browser metrics. Lightweight alternative.
Define a set of colors for light and dark themes. Get the CSS custom properties snippet. Toggle live.
Open a test video in Picture‑in‑Picture mode. Control entering and leaving PiP. Copy the code snippet for your own app.
Browse the fonts installed on your system and type a custom phrase to see how it looks. Uses Local Font Access API where available.
Compress text with Brotli at different quality levels. See size reduction and time. Find the sweet spot for your static assets.
Nest elements in 3D space with preserve‑3d vs flat. Rotate the parent and see children behave differently.
Toggle between full and reduced motion on a live animated page. See how to design for vestibular disorders. Educational.
Detect browser support for font‑tech() and font‑format() values in @font‑face src. Check COLRv1, variable, etc.
Drag a slider to compare your original image with a compressed version (e.g., WebP). See the quality difference and file size savings.
Highlight elements with aria‑describedby and see the linked description text. Verify a11y annotations.
Paste your Accept‑Language header and see which languages your site should serve based on quality values. Internationalization helper.
Enter a URL and see a visual map of the tab order. Detect broken tabindex values. Improve keyboard navigation.
Create seamless CSS background patterns like stripes, polka dots, checkerboard. Adjust size and colors. Copy the tiny CSS.
Simulate adaptive bitrate logic by switching between different quality video segments. See how ABR algorithms work.
Beautify and format your CSS stylesheets instantly. Organize, minify, or prettify CSS code for better readability. Processed securely on client-side.
Design a realistic neon sign text with multiple layers of glow. Copy the CSS and HTML. Perfect for headers.
Define multiple @layer blocks and see which styles win. Understand layer order and revert‑layer. Modern CSS architecture.
Convert normal text to Unicode mathematical bold, italic, script, fraktur, and double‑struck. Copy rich text for anywhere.
Enter a URL and extract tab‐index order violations and focusable elements. Quick accessibility audit. Client‑side fetch.
Tap any key to the beat and get the BPM (beats per minute). Useful for DJs, musicians, and running. Simple and accurate.
Toggle scrollbar‑gutter: stable to reserve space for the scrollbar and avoid content jumps. Visual demo with two columns.