The color-index media feature tests how many entries are in the output device’s color lookup table (palette). If the device does not use a lookup table, the value is 0.
It is a range feature: use (color-index), (color-index: <integer>), (min-color-index: <integer>), and (max-color-index: <integer>). This is different from color (bits per component) and color-gamut (gamut width).
Limited availability.
Not Baseline — missing or incomplete in some widely used browsers. Most modern true-color screens report 0, so queries rarely match phones and desktops. Use it as progressive simplification for indexed-color hardware.
Pair with color / monochrome when you also care about bit depth or grayscale.
Piece
Required?
Role
Base true-color styles
Yes
What most visitors see
@media (color-index…)
Optional
Simplifies for indexed palettes
Integer palette size
For min/max/exact
Number of lookup-table entries
Browser support check
Recommended
Feature has limited availability
Try it
Live Preview
This page checks your browser with matchMedia. On a typical phone or laptop you will often see no match for (color-index) and a match for (color-index: 0).
Device checks
Zero means “no color lookup table,” which is normal for true-color displays.
Results
(color-index): …
(min-color-index: 256): …
(color-index: 0): …
Sample note: styles inside indexed queries may not apply here.
Checking…
Code
CSS Examples
Each snippet focuses on color-index. On most modern screens these indexed rules will not apply — that is expected. Use Try It Yourself for a live editor.
Example 1 — Any Indexed Device
Change text color when a color lookup table exists.
CSS
<style>
p {
color: black;
}
@media (color-index) {
p {
color: crimson;
}
}
</style>
<p>Crimson only on indexed-color devices.</p>
Match exact zero.(color-index: 0) means no lookup table.
Common on modern screens. You will often see the blue panel here.
Use carefully. Prefer positive indexed queries when simplifying for limited palettes.
Edge Cases & Pitfalls
Most confusion comes from expecting phones to report a palette size.
limited
Not Baseline
Support is incomplete across major browsers. Never make critical layout depend only on color-index.
zero
Zero is normal today
True-color devices often report 0 (no lookup table). That does not mean “no color” — use color for that.
vs color
Different from bit depth
color = bits per RGB channel. color-index = palette entries. Do not mix the integers.
niche
Niche progressive enhancement
Useful for learning and specialized hardware. For everyday sites, prefer contrast, color-gamut, and solid defaults.
Compatibility
Browser Support
color-index is a browser CSS media feature. Node.js, Deno, and Bun do not evaluate it.
✓ Limited availability · Not Baseline
color-index
Implemented in some engines, missing or incomplete in others. Even where supported, modern true-color devices often report 0.
55%Limited
Google ChromePartial / varies
Check current docs
Mozilla FirefoxSupported
Full support
Apple SafariLimited
Check current docs
Microsoft EdgePartial / varies
Check current docs
OperaPartial / varies
Check current docs
Samsung InternetPartial / varies
Check current docs
Internet ExplorerLegacy
Older support varies
@media (color-index)Limited · Not Baseline
Bottom line: Treat as progressive simplification only. Keep full-color defaults. This is not a JavaScript runtime API.
Remember
Key Takeaways
Role: count entries in a color lookup table (palette).
Zero means no indexed table — common on true-color screens.
Range forms:min- / max-color-index for thresholds like 256.
Limited availability — enhance, don’t depend on it.
One line:color-index asks “how big is the palette?” — usually zero on modern screens, handy for niche indexed displays.
Frequently Asked Questions
It reports how many entries are in the output device’s color lookup table (palette). The value is zero when the device does not use an indexed color table.
The boolean form matches when the palette size is greater than zero — an indexed-color device. Most modern true-color screens report zero and do not match.
color reports bits per RGB component. color-index reports palette entries in a lookup table. They measure different display models.
They are range forms. For example, (min-color-index: 256) matches devices with at least 256 palette entries.
Rarely. Phones and monitors usually use true color, so the feature is mainly for specialized or legacy indexed-color hardware — treat it as progressive simplification.
No. MDN lists Limited availability — it does not work in some widely used browsers. It is a browser CSS media feature, not a Node.js API.