The monochrome media feature detects grayscale displays and their bit depth. Adapt styles for e-readers, industrial screens, and high-contrast monochrome environments.
01
@media
Media query.
02
(mono)
Boolean.
03
0
Full color.
04
Bits
Grayscale.
05
vs color
RGB depth.
06
A11y
Contrast.
Fundamentals
Introduction
Most screens today display millions of colors. Some specialized devices — e-readers, industrial panels, legacy terminals — show only grayscale (monochrome) output. The monochrome media feature lets CSS detect those devices and optimize for black-and-white display.
On a monochrome screen, subtle color differences disappear. Red and green buttons may look identical. The monochrome query helps you switch to high-contrast patterns, borders, and labels that work without color.
Definition and Usage
Write @media (monochrome) for any grayscale device, or use integer values like @media (monochrome: 0) for full-color devices and @media (min-monochrome: 1) for monochrome displays.
💡
Beginner Tip
Do not confuse this with filter: grayscale(), which converts colors in CSS. The media feature detects the device’s native display capability, not a visual filter applied to elements.
Foundation
📝 Syntax
Use integer values or the boolean form inside @media:
syntax.css
/* Any monochrome (grayscale) device */@media(monochrome){/* Grayscale display — bits > 0 */}/* Full-color device */@media(monochrome:0){/* Not monochrome */}/* At least 1 bit per pixel (monochrome) */@media(min-monochrome:1){/* Same as boolean (monochrome) */}/* Specific bit depth */@media(monochrome:2){/* Exactly 2 bits per pixel */}
Accepted Values
(monochrome) — Boolean form; matches when the device is grayscale (bits per pixel > 0).
monochrome: 0 — Device supports full color (not monochrome).
monochrome: N — Positive integer; bits per pixel on a monochrome display (e.g. 1, 2, 8).
min-monochrome / max-monochrome — Range queries for bit depth thresholds.
Color devices get a blue badge; monochrome devices get a high-contrast black badge with a white border.
Tips
💬 Usage Tips
Don’t rely on color alone — Use icons, labels, and borders on monochrome screens.
Maximize contrast — Black/white or near-black/near-white works best.
Simplify gradients — Replace with flat fills and strong outlines.
Test with grayscale filter — Preview designs in DevTools (visual only, not the media query).
Progressive enhancement — Base design must work without monochrome rules.
Watch Out
⚠️ Common Pitfalls
Confusing with filter: grayscale() — Media feature detects device; filter is visual effect.
Color-only status indicators — Red/green badges look identical in grayscale.
Assuming wide matching — Modern devices report monochrome: 0.
Thin fonts on e-ink — Increase weight for readability on low bit-depth screens.
Skipping accessible defaults — Monochrome rules are enhancement, not replacement.
A11y
♿ Accessibility
WCAG contrast — Aim for 4.5:1 or higher; 7:1 is ideal on grayscale.
Non-color cues — Icons, text labels, and patterns convey state.
Focus visibility — Strong focus rings on monochrome displays.
Semantic HTML — Proper headings and landmarks help all users.
Test readability — Print or preview in grayscale to spot issues early.
🧠 How monochrome Works
1
Browser reads display type
The user agent checks whether output is color or grayscale.
Detect
2
Bit depth reported
Returns 0 for color, or a positive integer for monochrome bits per pixel.
Evaluate
3
@media rules apply
Matching CSS simplifies UI and boosts contrast for grayscale output.
Apply
=
☀
Grayscale-ready UI
Content stays clear on e-readers and monochrome hardware.
Compatibility
🖥 Browser Compatibility
The monochrome media query syntax is supported in all modern browsers. True monochrome devices are rare, so the queries seldom match on everyday hardware.
✓ Baseline · Query supported
Grayscale display queries
Syntax works everywhere; matches mainly on specialized devices.
98%Query support
monochrome media feature (syntax)98% supported
Bottom line: Browsers understand monochrome queries, but almost all modern devices report monochrome: 0. Use as progressive enhancement for e-readers and specialized hardware.
Wrap Up
🎉 Conclusion
The monochrome media feature detects grayscale displays and their bit depth. Use it to deliver high-contrast, border-driven UI when color cannot be shown.
While rare on modern phones and laptops, monochrome queries matter for e-readers, industrial screens, and accessible design patterns. Always ship readable defaults and treat monochrome rules as progressive enhancement.
Use these points when styling for grayscale displays.
5
Core concepts
001
monochrome: 0
Full color.
Default
(m)02
(monochrome)
Grayscale.
Boolean
bpp03
Bits
Per pixel.
Depth
≠04
vs color
RGB depth.
Compare
98%05
Syntax OK
Rare match.
Compat
❓ Frequently Asked Questions
The monochrome media feature detects whether the output device is grayscale (monochrome) and how many bits per pixel it uses. Write @media (monochrome) for any monochrome device, or @media (monochrome: 0) when the device supports full color.
Non-negative integers: 0 means the device is not monochrome (full color). Any positive integer (1, 2, 8, etc.) indicates bits per pixel on a monochrome display. The boolean form (monochrome) matches when the value is greater than 0.
The color feature reports bit depth for color displays (RGB channels). The monochrome feature reports bit depth for grayscale-only devices. A full-color phone matches (color: 8) and (monochrome: 0).
Use it for e-readers, industrial grayscale screens, high-contrast accessibility fallbacks, and progressive simplification when color information cannot be displayed. Most modern devices won't match, so treat it as enhancement.
The media query syntax is supported in all modern browsers. However, very few devices today are truly monochrome, so the queries rarely match. The feature remains valuable for specialized hardware and learning display capability queries.