docs.rodeo

MDN Web Docs mirror

{{HTMLSidebar}} 

The color-scheme value for the name attribute of the {{htmlelement("meta")}}  element indicates a suggested color scheme that user agents should use for a page. If specified, you define the color scheme using a content attribute in the <meta> element with a valid CSS {{cssxref("color-scheme")}}  value.

The theme color works at the document level in the same way that the CSS {{cssxref("color-scheme")}}  property specifies the preferred and accepted color schemes of individual elements. The primary use for <meta name="color-scheme"> is to indicate compatibility and order of preference for light and dark color modes. For example, to indicate that a document prefers dark mode but also supports light mode:

<meta name="color-scheme" content="dark light" />

Your styles can adapt to the current color scheme using the {{cssxref("@media/prefers-color-scheme", "prefers-color-scheme")}}  CSS media feature.

Usage notes

A <meta name="color-scheme"> element has the following additional attributes:

Examples

Using a color-scheme keyword

The following example indicates to the browser that the page supports both light and dark themes. Whether the light or dark color scheme is used depends on user preferences such as OS-level settings or the browser settings:

<meta name="color-scheme" content="light dark" />

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN