The forced-colors CSS media feature is used to detect if the user agent has enabled a forced colors mode where it enforces a user-chosen limited color palette on the page.

Note: This feature is not supported by any user agent and its specifics are subject to change.


The forced-colors media feature indicates whether or not the browser is currently in forced-colors mode.


Forced colors mode is not active; the page’s colors are not being forced into a limited palette.
Indicates that forced colors mode is active. The browser provides the color palette to authors through the CSS system color keywords and, if appropriate, it triggers the appropriate value of prefers-color-scheme so that authors can adapt the page.

Usage notes

Properties affected by forced-color mode

In forced colors mode, the values of the following properties are treated as if they have no author-level values specified. That is, user-specified values (if any) or browser-specified values are used instead.

You can use system color keywords with any property other than those listed above, to ensure that the rest of the page integrates with the restricted color palette available in forced colors mode.

User preferences

This media feature is active only if the user has enabled color scheme preferences in their operating system. For example High Contrast mode on Windows.


Note: The below example will only work when using a browser that supports this media feature, and with a preference such as High Contrast mode enabled in your OS.

This example has an annoying color palette by default. This example does not take advantage of the colors provided by the user agent.


<div class="colors">weird color box</div>


.colors {
  background-color: red;
  color: grey;

@media (forced-colors: active) {
  .colors {
    background-color: white;
    color: black;



Specification Status Comment
Media Queries Level 5
The definition of 'forced-colors' in that specification.
Editor's Draft Initial definition.

Browser compatibility

BCD tables only load in the browser

See also