On this page
  1. light-dark()
  2. Syntax & Overview
  3. Notes & Best Practices
  4. Example

light-dark()

Prev: `color-mix()` | Up: color | Next: `linear-gradient()`
Rel: color, Color & Value Functions Guide
Ref: MDN Web Docs — light-dark()
Tags: #public #web #css #functions #color #tier/core


Syntax & Overview

light-dark(#ffffff, #141619)

Returns the first color in light color-scheme and the second in dark color-scheme.

Notes & Best Practices

Example

:root {
  color-scheme: light dark;
  --surface: light-dark(#ffffff, #14161a);
  --ink: light-dark(#1a1d21, #e8ecf2);
}
body { background: var(--surface); color: var(--ink); }

Linked from

Related notes