Skip to content

color-scheme

Utilities for controlling the color scheme of an element.

Source: https://tailwindcss.com/guide/color-scheme

Quick reference

ClassStyles
scheme-normalcolor-scheme: normal;
scheme-darkcolor-scheme: dark;
scheme-lightcolor-scheme: light;
scheme-light-darkcolor-scheme: light dark;
scheme-only-darkcolor-scheme: only dark;
scheme-only-lightcolor-scheme: only light;

Examples

Basic example

Use utilities like scheme-light and scheme-dark to control the color scheme of form controls:

html
<div class="scheme-light ...">
  <input type="date" />
</div>
<div class="scheme-dark ...">
  <input type="date" />
</div>
<div class="scheme-light-dark ...">
  <input type="date" />
</div>

Applying in dark mode

Use the dark: variant to apply different color schemes in dark mode:

html
<html class="dark:scheme-dark scheme-light ...">
  <!-- ... -->
</html>

Responsive design

Prefix a color-scheme utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

html
<div class="scheme-light md:scheme-dark ...">
  <!-- ... -->
</div>

Learn more about using variants in the variants documentation.

Released under the MIT License.