color

Class Description

color

Sets the text color via --color.

CSS Rules

.color {
  color: var(--color);
}

Usage

The .color class is flagged as a value-driven selector. The variable --color is required.
<element class="color" style="--color: /* value */;" />

Responsive & Dark Mode

Prefix .color utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl). If dark mode is applied, the dark: prefix always comes first.

<element class="md:color" style="--md-color: /* value */;" />

<element class="dark:sm:color" style="--dark-sm-color: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints and dark mode.

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="color:hover" style="--color-hover: /* value */;" />

<element class="dark:sm:color:hover" style="--dark-sm-color-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="color:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before color::before" style="--color-before: /* value */;" />

<element class="content-after color::after" style="--color-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="color=value" />

<!-- Output -->
<element class="color" style="--color: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.color Sets the text color via --color.

color/o

Sets text color + opacity via --color and --color-o independently.

CSS Rules

.color\/o {
  color: color-mix(in oklab, var(--color) var(--color-o, 100%), transparent);
}

Usage

The .color/o class is flagged as a value-driven selector. The variables --color and --color-o are required.
<element
  class="color/o"
  style="
    --color: /* value */;
    --color-o: /* value */;
  "
></element>

Responsive & Dark Mode

Prefix .color/o utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl). If dark mode is applied, the dark: prefix always comes first.

<element
  class="md:color/o"
  style="
    --md-color: /* value */;
    --md-color-o: /* value */;
  "
></element>

<element
  class="dark:sm:color/o"
  style="
    --dark-sm-color: /* value */;
    --dark-sm-color-o: /* value */;
  "
></element>

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints and dark mode.

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element
  class="color/o:hover"
  style="
    --color-hover: /* value */;
    --color-o-hover: /* value */;
  "
></element>

<element
  class="dark:sm:color/o:hover"
  style="
    --dark-sm-color-hover: /* value */;
    --dark-sm-color-o-hover: /* value */;
  "
></element>

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="color/o:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element
  class="content-before color/o::before"
  style="
    --color-before: /* value */;
    --color-o-before: /* value */;
  "
></element>

<element
  class="content-after color/o::after"
  style="
    --color-after: /* value */;
    --color-o-after: /* value */;
  "
></element>

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="color/o=value" />

<!-- Output -->
<element class="color/o" style="--color: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.color/o Sets text color + opacity via --color and --color-o independently.