color‑scheme Meta Generator - Online Dark/Light Opt‑in
Generate the <meta name='color‑scheme'> tag and CSS property to enable native dark/light rendering. Quick copy.
UD5 Toolkit
/* Detect system color scheme */ @media (prefers-color-scheme: dark) { body { background-color: #1a1a2e; color: #e0e0e0; } } @media (prefers-color-scheme: light) { body { background-color: #ffffff; color: #1a1d23; } }
/* Tell browser which scheme to use */ :root { color-scheme: light dark; } .dark-theme { color-scheme: dark; --bg: #1e1e2e; --text: #e0e0e0; --surface: #2d2d3f; }
prefers-color-scheme?
prefers-color-scheme is a CSS media feature that detects whether the user has requested a light or dark color theme at the operating system level. It allows websites to automatically adapt their appearance to match the user's system preference, providing a seamless and comfortable viewing experience. The possible values are light, dark, and no-preference.
prefers-color-scheme?
prefers-color-scheme is widely supported across all modern browsers: Chrome 76+, Firefox 67+, Safari 12.1+, Edge 79+, and Opera 62+. It also works on mobile browsers including iOS Safari 13+ and Chrome for Android. Global browser support exceeds 97% as of 2025, making it safe for production use.
color-scheme and prefers-color-scheme?
prefers-color-scheme is a media query that detects the user's OS-level preference (read-only). color-scheme is a CSS property that tells the browser which color scheme an element should render with. Setting color-scheme: dark on an element makes native UI controls (inputs, selects, scrollbars, buttons) render in their dark variant. They work best together: use prefers-color-scheme to detect preference, and color-scheme to inform the browser how to render form elements.
Use window.matchMedia('(prefers-color-scheme: dark)') in JavaScript. This returns a MediaQueryList object with a matches boolean property. You can also listen for real-time changes using addEventListener('change', callback), which fires whenever the user toggles their system theme. This enables dynamic, instant theme switching without page reload.
This is often because the color-scheme CSS property hasn't been set. While prefers-color-scheme detects the system setting, native form controls won't automatically switch to dark styling unless you explicitly set color-scheme: dark on the :root or body element. Add :root { color-scheme: light dark; } to your global styles to enable automatic adaptation of native UI elements.
The best practice is a three-state toggle: Light, Dark, and Auto (follow system). Store the user's choice in localStorage and apply the appropriate class or attribute to the <html> element. Use CSS custom properties (variables) scoped to [data-theme="dark"] and [data-theme="light"] selectors for full control. In Auto mode, fall back to prefers-color-scheme media queries.
prefers-color-scheme in DevTools?
Yes! In Chrome DevTools, open the Command Menu (Cmd+Shift+P / Ctrl+Shift+P), type "Show Rendering," and in the Rendering tab you'll find an option to emulate prefers-color-scheme. In Firefox, open DevTools Settings and check "Enable prefers-color-scheme simulation." This tool above provides a live preview alternative without opening DevTools.
Indirectly, yes. Google considers Core Web Vitals and user experience as ranking factors. A well-implemented dark mode reduces eye strain, improves readability in low-light environments, and can increase time-on-page. Additionally, respecting user preferences signals good UX design. While prefers-color-scheme itself isn't a direct ranking signal, the improved engagement metrics can positively impact SEO.
Generate the <meta name='color‑scheme'> tag and CSS property to enable native dark/light rendering. Quick copy.
Start from a base color and use `oklch(from color l c h)` to create lighter or darker variants. Copy the code.
Browse the OKLCH color space with sliders for lightness, chroma, and hue. See the CSS oklch() code. Modern and accessible.
Toggle image‑rendering: auto, pixelated, crisp‑edges on a scaled image. Essential for pixel art display.
Upload a gradient or enter a palette and simulate how it appears with different types of color vision deficiency. Ensure inclusive data visualization.
Experiment with the CSS color-mix() function. Pick two colors and mix them in different color spaces (srgb, oklch). Copy the CSS.
Paste a media query and instantly check for syntax errors. See if it's correctly formed. Quick developer tool.
Upload any picture and instantly get a 5‑color palette. Useful for UI design themes. Canvas‑based extraction.
A dedicated color picker with common retro gaming palettes (NES, Gameboy). Pick and copy hex codes. For pixel art creators.
Combine aspect‑ratio with min‑/max‑width/height and see how the box responds. Understand sizing constraints. Copy the pattern.
Interactively apply CSS filter functions (blur, brightness, contrast, etc.) to an image and copy the resulting filter property. No coding required.
Given an RGB value, pick the matching color square. Multiple difficulty levels. Improve your color perception. Fun for designers.
Point your camera at an object and see the dominant color in real time. Click to copy the hex. Fun tool for designers.
Build a CSS media query by selecting feature, operator, and value. Copy the exact syntax for your stylesheet.
Enter a website URL and apply a protanopia/deuteranopia/tritanopia filter. Test full page accessibility.
An interactive color wheel that teaches primary, secondary, tertiary colors, and harmonies. Pick and mix like a pro.
Add a dramatic night‑vision green tint with grain and scanlines to any image. Fun horror/military aesthetic.
Keep one selected color and turn the rest of the image to grayscale. Eye‑catching selective color effect. Pure canvas.
Answer a few questions and get a playful color-based personality result. For entertainment only.
Test the new style() function inside @container to query custom property values. Revolutionary component‑based responsive design.
Upload an image at multiple widths and generate a complete <picture> or <img srcset> snippet. Modern web performance.
Select two paint colors and see approximate mixed result. Visual blending for artists.
See how your page title and description will look in Google SERP. Check pixel width and character count. Local tool.
Simulate reduced motion preference and test your animations. Copy the media query snippet. Keep your users safe.
Increase or decrease the color saturation of your photo with a slider. Preview instantly. Download the edited image. Canvas‑based.
Upload an image and extract its dominant colors or full color palette. Download as a CSS snippet or color swatch. Entirely client-side, your images stay private.
Enter the URL of any image and receive a random harmonious palette extracted from it. Click to regen. For quick inspiration.
Create a responsive box that maintains a specific aspect ratio using the aspect‑ratio property. Copy the simple CSS.
Enter foreground and background colors to instantly see the contrast ratio and pass/fail for AA and AAA. Simple and fast.
A horizontal photo gallery that scrolls with a smooth CSS animation using scroll‑timeline. Pure HTML/CSS. Copy the code.