company logo

Help center

Go to KiteApps
App StoreVideo Tutorials
All collectionsSwatchfy Color SwatchDevelopersCustom CSS: classes and variables

Custom CSS: classes and variables

The 29 class names and 78 CSS variables Swatchfy exposes, why overriding a variable needs !important, and recipes for the common asks.

Cuong Dao·November 12, 2026

Almost everything about how swatches look is a control on the Appearance page, and that is the right place to change it — those settings survive updates and apply per look and per surface.

This page is for the rest: the times you need something the controls do not offer. Swatchfy exposes 29 stable class names and 78 CSS custom properties for exactly that.

Put your rules in Swatchfy → Settings → Custom CSS. They are injected on the storefront after the app's own stylesheet.

⚠ Read this first: you will usually need !important

Swatchfy writes its variables inline on each swatch row, from Liquid at page render and again from JavaScript after the config loads. Inline styles beat stylesheet rules, so this does nothing:

JavaScript
/* Does not work — the inline value wins */
.swatchfy-swatches { --kx-bc: #000; }

and this works:

JavaScript
.swatchfy-swatches { --kx-bc: #000 !important; }

Rules that target ordinary properties rather than the variables behave normally and need no !important:

JavaScript
.swatchfy-swatch-item { box-shadow: 0 1px 3px rgba(0,0,0,.15); }

Prefer that second form when you can. Overriding a variable fights the app's own settings; adding a property the app does not set does not.

The classes

Row structure

Class

What it is

.swatchfy-swatches

The row container, one per option. Carries data-swatchfy-option, data-swatchfy-option-index and data-swatchfy-slug.

.swatchfy-swatches__optlabel

The label line above the swatches

.swatchfy-swatches__optcaption

Name and value welded together as one flex item

.swatchfy-swatches__optname · __optvalue

The name, and the selected value

.swatchfy-swatches__optslot

The empty box at the end of the label row, for your own content — see Swatch events and the JavaScript API

.swatchfy-swatches__row

The swatches themselves

Product page and product cards are two namespaces

Everything in this section is the product page. Card swatches render under their own names, so a rule written for one does not reach the other:

Product page

Product card

Row container

.swatchfy-swatches

.swatchfy-card-swatches

One swatch

.swatchfy-swatch-item (also carries .swatchfy-swatch)

.swatchfy-card-swatch

The state and look modifiers below — --pill, .swatchfy-selected, .swatchfy-soldout and the rest — are shared.

One swatch

Class

What it is

.swatchfy-swatch-item

One swatch on a product page. It also carries the shorter .swatchfy-swatch, and every modifier below sits on this element.

.swatchfy-swatch__visual

The colour or image inside it

.swatchfy-swatch__label

The text under an image or colour swatch

.swatchfy-swatch__pilltext

The text inside a button or pill

.swatchfy-swatch__price

The price under a swatch

.swatchfy-swatch__so

The sold-out marker

.swatchfy-swatch__zoom

The hover-zoom wrapper

Which look is rendering

.swatchfy-swatch--bare · --framed · --frameddot · --pill · --swatchpill · --priced · --more

--more is the "+3" counter when an option has more values than fit.

State

Class

Meaning

.swatchfy-selected

The value the shopper has chosen

.swatchfy-soldout

Out of stock

.swatchfy-hidden

Hidden by the app

.swatchfy-adv-hidden

Hidden by an advanced setting — sold-out or deleted combinations

Overflow

.swatchfy-swatches--slides · .swatchfy-swatches__slider · .swatchfy-swatches__arrow appear when the row is set to carousel.

The variables

The names are terse but systematic. Read them as group + property, and two suffixes mean state: h = hover, s = selected.

Prefix

Group

(none)

The swatch itself — size, h (height), radius, fit, zoom, gap, align, mt, mb, mbetween

b

Borders and backgrounds — bw, bc, bg, and bch/bgh/bws/bcs/bgs

ol

Option label — olfs, olc, olvc, olmt, olmb

l

The text label under a swatch — lfs, lc, lweight, lalign, lbg, lph, lpv, lmt, lmb, lch, lcs

pl

The pill or button box — plbw, plbc, plbg, plradius, plfs, plfw, plminw, plph, plpv, pltc, pltt, and their h/s forms

pr

Price — prc, prfs, prfw, prmt, prmb, prpv, prch, prcs

so

Sold-out treatment — soline, solw, soimgop, sopillop, sopline

tip

Tooltip — tipbg, tipc, tipfs, tipradius

dot, i

The inline colour dot and its gap — dotsize, dotradius, igap

more

The overflow counter — morec, morefs

img

Padding inside an image swatch — imgph, imgpv

So --kx-plbcs is pill · border colour · selected, and --kx-bgh is background · hover.

To read the exact current value for any of them, inspect a swatch row in your browser's dev tools — every variable in play is printed on the row element.

Recipes

A thicker ring on the selected swatch

JavaScript
.swatchfy-swatches { --kx-bws: 3px !important; --kx-bcs: #111 !important; }

Square swatches on collection cards only

JavaScript
.swatchfy-card-swatches .swatchfy-card-swatch { border-radius: 2px; }

Dim sold-out values further than the setting allows

JavaScript
.swatchfy-swatch-item.swatchfy-soldout { opacity: .35; }

Style one option only — use the row's own data attribute rather than a class, and prefer the index, which survives translation:

JavaScript
.swatchfy-swatches[data-swatchfy-option-index="0"] .swatchfy-swatch-item {  
border-radius: 50%;
}

Stability

The class names and data attributes above are treated as public and are kept stable across updates.

The --kx-* variables are also stable, but their values move whenever a merchant changes a setting on the Appearance page — that is what they are for. If a rule must hold regardless of the settings, target the property directly rather than the variable.

Did this answer your question?
😞
😐
😁