The color-index media feature detects how many colors exist in a device’s palette lookup table. Use it to simplify designs on indexed-color or limited-palette displays.
01
@media
Media query.
02
Palette
Lookup table.
03
min-
At least N.
04
max-
At most N.
05
vs color
Bits vs index.
06
Legacy
Niche use.
Fundamentals
Introduction
The @media color-index feature targets devices based on the number of entries in their color lookup table — the palette used by indexed-color displays. Instead of mixing millions of RGB values directly, some hardware picks colors from a fixed table of 256 (or fewer) swatches.
Most modern phones, laptops, and monitors report a very high color-index value. This feature is mainly useful for progressive simplification on legacy or specialized hardware, or when you want to understand how CSS models display capabilities.
Definition and Usage
Write integer values inside media queries: @media (min-color-index: 256), @media (max-color-index: 256), or an exact @media (color-index: 256). The boolean form (color-index) matches any indexed-color device.
💡
Beginner Tip
256 palette entries often corresponds to classic 8-bit indexed color. Prefer min-color-index and max-color-index over exact matches for more reliable responsive rules.
Foundation
📝 Syntax
Use positive integers with the color-index media feature:
syntax.css
@media(color-index:256){/* Exact 256-entry palette */}@media(min-color-index:256){/* At least 256 palette colors */}@media(max-color-index:256){/* At most 256 palette colors */}@media(color-index){/* Any indexed-color device */}
Feature Variants
color-index — Boolean or exact integer for palette table size.
min-color-index — Matches when the palette has at least N entries.
max-color-index — Matches when the palette has at most N entries (limited-color devices).
color-index vs color Media Feature
(color: 8) / min-color: 8 Measures bits per color component in true-color displays (e.g. 8-bit red, green, blue channels).
(color-index: 256) Measures palette table size for indexed-color displays that pick from a fixed swatch list.
Over-engineering — Don’t build entire layouts around color-index unless you target legacy hardware.
Color-only cues — Limited palettes make subtle shade differences harder; use icons and labels.
A11y
♿ Accessibility
Strong contrast — On limited palettes, subtle grays may collapse; use high-contrast pairs.
Do not rely on fine shades — Status colors may dither; pair with text and icons.
Readable defaults — Base styles must work even when enhancement queries never match.
Test simplification — Verify that max-color-index fallbacks remain fully usable.
Color blindness — Palette limits compound confusion between similar hues.
🧠 How color-index Works
1
Browser queries palette
The user agent reads how many entries exist in the device color lookup table.
Query
2
Integer compared
color-index, min-, or max- values are matched against the reported size.
Match
3
Styles adapt
Matching rules simplify or enrich colors based on palette capacity.
Apply
=
🎨
Palette-aware design
UI stays readable on indexed-color and limited-palette hardware.
Compatibility
🖥 Browser Compatibility
The color-index media feature is supported in modern browsers, though practical use is niche today.
✓ Baseline · Modern browsers
Palette queries supported
Works in Chrome, Firefox, Safari, and Edge.
96%Global support
color-index media feature96% supported
Bottom line: Supported everywhere, but low-palette matches are rare on current consumer hardware. Use for progressive simplification, not core layout logic.
Wrap Up
🎉 Conclusion
The color-index media feature targets devices by palette lookup table size. While uncommon in everyday responsive design, it teaches an important distinction: indexed-color hardware picks from a fixed swatch list rather than mixing millions of RGB values directly.
Use max-color-index to simplify on limited palettes, pair with the color and color-gamut features for a complete picture of display capability, and always ship polished defaults for modern screens.
Use these points when adapting to palette-limited displays.
5
Core concepts
#01
Palette
Lookup table.
Concept
25602
Classic
8-bit index.
Value
max03
max-
Simplify UI.
Pattern
8b04
vs color
Bits vs index.
Compare
🌐05
Niche today
Legacy use.
Context
❓ Frequently Asked Questions
The color-index media feature detects how many entries are in a device color lookup table — the palette size for indexed-color displays. Use @media (min-color-index: 256) or (max-color-index: 256) to adapt styles for limited-palette hardware.
The color media feature reports bits per color component (true-color depth). color-index reports the number of colors in an indexed palette lookup table. They measure different display characteristics.
color-index accepts positive integers. Use (color-index: 256) for an exact palette size, (min-color-index: 256) for at least 256 colors, or (max-color-index: 256) for at most 256 colors. The boolean (color-index) matches indexed-color devices with any palette.
Rarely for mainstream sites — most current displays support millions of colors. It remains useful for progressive simplification on very limited displays, embedded screens, or niche legacy hardware where a smaller palette improves consistency.
Yes. color-index, min-color-index, and max-color-index are supported in modern browsers. On typical phones and desktops the value is very high, so matching queries for low palette sizes is uncommon in everyday browsing.