The color media feature detects whether a device can display color. Adapt styles for full-color screens vs monochrome displays, and distinguish the media feature from the CSS color property.
01
@media
Media query.
02
(color)
Has color.
03
not
Monochrome.
04
min-color
Bit depth.
05
vs property
Device vs text.
06
A11y
Not color-only.
Fundamentals
Introduction
The @media color feature in CSS checks whether the output device can display color. It is used inside media queries to apply different styles depending on display capability — from full-color monitors and phones to grayscale e-readers or monochrome terminals.
While nearly every modern screen matches (color), this feature is still valuable for progressive enhancement, print stylesheets, and providing accessible fallbacks when color cannot convey meaning alone.
Definition and Usage
Write @media (color) for color-capable devices and @media not (color) for devices without color support. You can also use min-color and max-color with a numeric bit depth per color component.
💡
Beginner Tip
Do not confuse this with the CSS color property, which sets text color. The media feature asks: “Can this device show color?”
Foundation
📝 Syntax
The basic forms of the color media feature are:
syntax.css
@media(color){/* Color-capable devices */}@medianot(color){/* Monochrome or grayscale devices */}@media(min-color:8){/* 8+ bits per color component (true color) */}
Feature Variants
(color) — Matches when the device supports color (equivalent to min-color: 1).
not (color) — Matches monochrome devices with zero color bits.
min-color — Matches when the device has at least N bits per color component.
max-color — Matches when the device has at most N bits per color component.
Info: Blue accent border from @media (color); text color from the color property.
How It Works
The media query adds a colored accent border on color devices; the color property sets readable text on every device.
Tips
💬 Usage Tips
Progressive enhancement — Design for monochrome first, then add color with (color).
Pair with icons — Never use color as the only way to communicate status or errors.
min-color for gradients — Reserve complex gradients for (min-color: 8) displays.
Print styles — Combine with @media print for black-and-white output.
Name collision — Remember: media color = device; property color = text.
Watch Out
⚠️ Common Pitfalls
Assuming not (color) is common — Almost all modern browsers and devices match (color).
Color-only meaning — Red/green status colors fail for color-blind users; add icons and labels.
Confusing with color property — They share a name but serve different purposes.
Replacing contrast checks — (color) does not guarantee sufficient contrast; test WCAG ratios.
Overusing bit-depth queries — min-color: 8 matches virtually all current hardware.
A11y
♿ Accessibility
Do not rely on color alone — WCAG requires a non-color way to convey information.
Monochrome fallbacks — Use not (color) to ensure borders, icons, and labels remain clear.
Color blindness — Test with simulators; red/green pairs are especially problematic.
Sufficient contrast — Colorful badges must still meet contrast requirements on all backgrounds.
High contrast mode — Users may override colors; layouts must remain usable.
🧠 How color Works
1
Browser queries device
The user agent asks the output device how many bits of color it supports per component.
Query
2
Feature matches or not
(color) matches if bits ≥ 1. not (color) matches if bits = 0.
Match
3
Conditional CSS applies
Styles inside matching @media blocks update colors, borders, and backgrounds.
Apply
=
🎨
Device-appropriate design
Colorful on capable screens; readable everywhere else.
Compatibility
🖥 Browser Compatibility
The color media feature and its min- / max- variants are supported in all modern browsers.
✓ Baseline · Universal support
Color capability queries
Works in Chrome, Firefox, Safari, Edge, and Opera.
99%Global support
color media feature99% supported
Bottom line:(color) is safe for progressive enhancement. Always provide non-color cues for accessibility.
Wrap Up
🎉 Conclusion
The color media feature lets you tailor styles to a device’s color display capability. Use (color) to enhance designs with rich hues and not (color) to provide clean monochrome fallbacks for e-readers and specialized displays.
Remember the naming distinction: the media feature detects device capability; the color property sets element text color. Combine both with icons and labels so your UI works for everyone.
Use these points when adapting styles to display capability.
5
Core concepts
@01
Device check
Not text color.
Scope
✓02
(color)
Has color.
Match
✗03
not (color)
Monochrome.
Fallback
804
min-color
Bit depth.
Syntax
♿05
Icons + labels
Not color-only.
A11y
❓ Frequently Asked Questions
The color media feature detects whether the output device can display color. @media (color) matches color-capable screens; @media not (color) matches monochrome or grayscale devices such as some e-readers or specialized displays.
(color) applies styles when the device supports at least one bit of color per component — essentially all modern screens. not (color) applies when the device has zero color bits, meaning grayscale or monochrome output only.
The media feature is a device capability check inside @media rules. The color property sets the text or foreground color of an element. They share a name but solve completely different problems.
min-color matches when the device supports at least the specified number of bits per color component. For example, (min-color: 8) targets true-color displays with 8 or more bits, useful for enabling rich gradients on capable hardware.
Yes. (color), not (color), min-color, and max-color are supported in all modern browsers. Nearly all current devices match (color), but the feature remains useful for progressive enhancement and accessibility fallbacks.