fill

Class Description

fill

Sets SVG fill color via --fill.

CSS Rules

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

Usage

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

Responsive & Dark Mode

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

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

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

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

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

CLS Alert

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

.fill Sets SVG fill color via --fill.

fill/o

Sets SVG fill color + opacity via --fill and --fill-o.

CSS Rules

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

Usage

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

Responsive & Dark Mode

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

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

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

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

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

CLS Alert

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

.fill/o Sets SVG fill color + opacity via --fill and --fill-o.