# Color Scheme

Set which color schemes an element can be rendered in.

**Widely available.** This feature is well established and works across many devices and browser versions.

Chrome 98 · Edge 98 · Firefox 96 · Safari 13

| Class | Properties | Value |
|-------|------------|-------|
| `cs:d` | color-scheme | `dark` |
| `cs:l` | color-scheme | `light` |
| `cs:ld` | color-scheme | `light dark` |

> **Note**
>
> With a paired color in your theme, `:root` gets `color-scheme: light dark`.
> These utilities override it.

## Variants

Prefix any class with a variant to apply it only under that condition. Variants stack, as in `@md:h:cs:l`.

### Breakpoints

Apply a class from a viewport width up. Each breakpoint covers its width & every width above it.

| Class | Applies |
|-------|---------|
| `@xs:cs:l` | From 32rem up. |
| `@sm:cs:l` | From 40rem up. |
| `@md:cs:l` | From 48rem up. |
| `@lg:cs:l` | From 64rem up. |
| `@xl:cs:l` | From 80rem up. |
| `@xxl:cs:l` | From 96rem up. |

### Containers

Apply a class from a container's width up, not the viewport's. Mark the parent with `ct:is` first.

| Class | Applies |
|-------|---------|
| `@c:xs:cs:l` | Container from 32rem up. |
| `@c:sm:cs:l` | Container from 40rem up. |
| `@c:md:cs:l` | Container from 48rem up. |
| `@c:lg:cs:l` | Container from 64rem up. |
| `@c:xl:cs:l` | Container from 80rem up. |
| `@c:xxl:cs:l` | Container from 96rem up. |

### Media

Apply a class when the device or the page matches a condition, or on the first frame an element renders.

| Class | Applies |
|-------|---------|
| `@pc:cs:l` | On a touch screen. |
| `@prm:cs:l` | With reduced motion on. |
| `@st:cs:l` | On the first frame. |

### States

Apply a class only while the element is in a state, such as hovered, focused or checked.

| Class | Applies |
|-------|---------|
| `h:cs:l` | On :hover. |
| `f:cs:l` | On :focus. |
| `fv:cs:l` | On :focus-visible. |
| `a:cs:l` | On :active. |
| `d:cs:l` | On :disabled. |
| `fc:cs:l` | On :first-child. |
| `c:cs:l` | On :checked. |
| `e:cs:l` | On :empty. |
| `fw:cs:l` | On :focus-within. |
| `i:cs:l` | On :invalid. |
| `in:cs:l` | On :indeterminate. |
| `lc:cs:l` | On :last-child. |
| `nc:cs:l` | On :nth-child. |
| `r:cs:l` | On :required. |
| `ro:cs:l` | On :read-only. |
| `v:cs:l` | On :valid. |

### Pseudo Elements

Style a part of the element rather than the element itself, such as its placeholder or the selected text.

| Class | Applies |
|-------|---------|
| `a::cs:l` | On ::after. |
| `b::cs:l` | On ::before. |
| `p::cs:l` | On ::placeholder. |
| `s::cs:l` | On ::selection. |