Skip to content

Iconography

Icon Color

Utilities for controlling the icon color.

s-prefix

The s- (semantic) prefix signals that the color value of these will change with the brand css.

Quick reference

New in v2

To cater for upcoming dark mode, we've added two classes.
Whenever you have an icon that should be "black" in both light and dark mode, use s-icon-static.
If you have an icon that should be "white" in both light and dark mode, use s-icon-inverted-static.

Basic usage

Setting the icon color

Control the color of an icon using the s-icon-{semantic color} utilities specified in the table above.

Full starFull starFull starFull star
html
<icon-star-full-32 class="s-icon ..." />
<icon-star-full-32 class="s-icon-primary ..." />
<icon-star-full-32 class="s-icon-positive ..." />
<icon-star-full-32 class="s-icon-warning ..." />

Arbitrary values

If you need to use a one-off icon-{color} value, use the text utility class with square brackets to set the color css property. We recommend only using our semantic color tokens for this.

html
<p class="text-[--w-s-color-border]"></p>

Opacity

It is possible to control the opacity of the icon color by adding an optional alpha modifier. The modifier accepts any integer percentage value between 0 and 100. This works for the semantic icon classes, and you can also use the arbitrary text classes with any primitive --w-{color} or semantic --w-s-color-{name} css variable.

Warning

Please be advised that by using primitive variables you will lose theming possibilities, therefore we highly recommend only using semantic classes and tokens.

The examples below are inaccessible and purely for technical reference. Always make sure to have sufficient contrast.

Full star
Full star
Full star
Full star
html
<icon-star-full-32 class="s-icon/60 hover:s-icon/100 ..." />
<icon-star-full-32 class="s-icon-primary/60 hover:s-icon-primary/100 ... ..." />
<icon-star-full-32 class="text-[--w-s-color-text-positive/60] hover:text-[--w-s-color-text-positive/100] ..." />
<icon-star-full-32 class="text-[var(--w-black)/50] hover:text-[var(--w-black)/100] ..." />