accent-color

Class Description

accent

Sets the accent color via --accent. Used for highlights, focus rings, and branded tints.

CSS Rules

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

Usage

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

Responsive & Dark Mode

Prefix .accent 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:accent" style="--md-accent: /* value */;" />

<element class="dark:sm:accent" style="--dark-sm-accent: /* 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="accent:hover" style="--accent-hover: /* value */;" />

<element class="dark:sm:accent:hover" style="--dark-sm-accent-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="accent: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 accent::before" style="--accent-before: /* value */;" />

<element class="content-after accent::after" style="--accent-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="accent=value" />

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

CLS Alert

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

.accent Sets the accent color via --accent. Used for highlights, focus rings, and branded tints.

accent/o

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

CSS Rules

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

Usage

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

Responsive & Dark Mode

Prefix .accent/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:accent/o"
  style="
    --md-accent: /* value */;
    --md-accent-o: /* value */;
  "
></element>

<element
  class="dark:sm:accent/o"
  style="
    --dark-sm-accent: /* value */;
    --dark-sm-accent-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="accent/o:hover"
  style="
    --accent-hover: /* value */;
    --accent-o-hover: /* value */;
  "
></element>

<element
  class="dark:sm:accent/o:hover"
  style="
    --dark-sm-accent-hover: /* value */;
    --dark-sm-accent-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="accent/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 accent/o::before"
  style="
    --accent-before: /* value */;
    --accent-o-before: /* value */;
  "
></element>

<element
  class="content-after accent/o::after"
  style="
    --accent-after: /* value */;
    --accent-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="accent/o=value" />

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

CLS Alert

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

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