CSS monochrome Media Feature

Beginner
⏱️ 6 min read
📚 Updated: Jul 2026
🎯 4 Examples
Media Queries

What You’ll Learn

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.

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.

📝 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.

monochrome vs color Media Feature

(monochrome: 0) Full-color display. Grayscale bits = 0. Typical phones and laptops.
(color: 8) 8 bits per RGB color component. Measures color display depth, not grayscale.

Basic Example

monochrome-basic.css
body {
  background-color: #fff;
  color: #1e293b;
}

@media (monochrome) {
  body {
    background-color: #000;
    color: #fff;
  }
}

Default Value

The default is 0 (full color) on virtually all modern devices. Monochrome queries are progressive enhancement.

Syntax Rules

  • Boolean (monochrome) is equivalent to (min-monochrome: 1).
  • Use (monochrome: 0) to target full-color devices explicitly.
  • Rely on contrast, borders, and labels — not color alone — on monochrome screens.
  • Do not confuse with CSS filter: grayscale().
  • Pair with semantic HTML for baseline accessibility.

Related Topics

@media (monochrome) @media (monochrome: 0) @media (min-monochrome: 1)

⚡ Quick Reference

QuestionAnswer
Feature namemonochrome, min-monochrome, max-monochrome
Boolean form@media (monochrome)
Full-color devicemonochrome: 0
Grayscale devicePositive integer (bits per pixel)
What it detectsGrayscale display capability and bit depth
Modern devicesAlmost always monochrome: 0
Browser supportQuery supported; matches rarely on modern hardware

When to Use monochrome

Reach for monochrome when display color capability matters:

  • E-readers — Optimize reading UI for grayscale e-ink screens.
  • Industrial displays — Adapt for monochrome panel hardware.
  • High-contrast fallback — Simplify UI when color cannot convey meaning.
  • Progressive enhancement — Layer on top of accessible defaults.
  • Learning media queries — Understand display capability detection.

👀 Live Preview

On full-color devices this block stays white with dark text. On true monochrome displays it inverts to black background with white text:

Monochrome Demo @media (monochrome) — grayscale display

Grayscale palette reference (what monochrome users effectively see):

Examples Gallery

Practice monochrome with page themes, high-contrast buttons, simplified cards, and comparisons to the color feature.

📜 Core Patterns

Adapt styles when the device displays only grayscale.

Example 1 — Page theme for monochrome displays

Invert to high-contrast black and white when viewed on a grayscale device:

monochrome-theme.css
body {
  background-color: #fff;
  color: #1e293b;
}

@media (monochrome) {
  body {
    background-color: #000;
    color: #fff;
  }
}
Try It Yourself

How It Works

This is the classic pattern from the reference tutorial — maximum contrast for grayscale screens.

Example 2 — High-contrast buttons without color

Add borders and labels so buttons remain distinguishable without color cues:

monochrome-buttons.css
.btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 0.45rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }

@media (monochrome) {
  .btn {
    background: #fff;
    color: #000;
    border: 2px solid #000;
  }
  .btn-primary { background: #000; color: #fff; }
}
Try It Yourself

How It Works

Blue and red look similar in grayscale. Filled vs outlined buttons stay distinct through contrast and borders.

Example 3 — Simplify cards on monochrome

Remove color gradients and rely on borders and typography:

monochrome-cards.css
.card {
  padding: 1rem;
  background: linear-gradient(135deg, #dbeafe, #fce7f3);
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (monochrome) {
  .card {
    background: #fff;
    border: 2px solid #000;
    box-shadow: none;
    font-weight: 500;
  }
}
Try It Yourself

How It Works

Gradients collapse to similar grays on e-ink. A bold border and medium font weight keep cards readable.

Example 4 — monochrome vs color bit depth

Target full-color devices and monochrome devices separately:

monochrome-vs-color.css
/* Full-color display */
@media (monochrome: 0) and (min-color: 8) {
  .badge {
    background: #2563eb;
    color: #fff;
  }
}

/* Grayscale display */
@media (monochrome) {
  .badge {
    background: #000;
    color: #fff;
    border: 1px solid #fff;
  }
}

.badge {
  display: inline-block;
  padding: 0.4rem 0.65rem;
  border-radius: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
}
Try It Yourself

How It Works

Color devices get a blue badge; monochrome devices get a high-contrast black badge with a white border.

💬 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.

⚠️ 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.

♿ 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.

🖥 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.

🎉 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.

💡 Best Practices

✅ Do

  • Use borders and labels
  • Maximize contrast
  • Simplify gradients
  • Ship accessible defaults
  • Test grayscale preview

❌ Don’t

  • Rely on color alone
  • Confuse with CSS filter
  • Require monochrome match
  • Use thin fonts on e-ink
  • Skip non-color cues

Key Takeaways

Knowledge Unlocked

Five things to remember about monochrome

Use these points when styling for grayscale displays.

5
Core concepts
(m) 02

(monochrome)

Grayscale.

Boolean
bpp 03

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.

Practice in the Live Editor

Open the HTML editor and experiment with @media (monochrome) high-contrast patterns.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful