Color Scheme
ELI5 — The Vibe Check
CSS color-scheme tells the browser whether your page supports light mode, dark mode, or both. When set, browser-provided UI elements (scrollbars, form controls, text selection) automatically adapt to the user's preference. It's dark mode for the bits you don't style yourself.
Real Talk
The CSS color-scheme property and corresponding meta tag indicate which color schemes a page supports. Setting color-scheme: light dark allows the browser to adapt default UA styles (form controls, scrollbars, canvas background) to the user's preferred color scheme without custom CSS.
Show Me The Code
/* Let the browser adapt to light or dark */
:root {
color-scheme: light dark;
}
/* Or in HTML */
<meta name="color-scheme" content="light dark">
When You'll Hear This
"Add color-scheme: light dark and your scrollbars automatically match dark mode" / "Without color-scheme, form inputs stay white even when the rest of the page is dark"
Related Terms
CSS Variables
CSS Variables (officially called Custom Properties) let you store values in CSS and reuse them everywhere.
Media Query
A media query is a CSS if-statement based on screen conditions. 'If the screen is narrower than 768px, apply these styles.
Responsive Design
Responsive design means your website looks good on EVERY screen size — from a tiny phone to a giant 4K monitor.