Skip to main content
Introducing packages.sweber.dev
Documentation menuCLI

CLI

All options of the gradient command.

npx @sweberdev/gradient <color> [name=color ...] [options]

Colors can be hex (#e30613, #f00), rgb(), hsl() or oklch(). Quote them in the shell. The first color is named brand unless you pass --name or name=color.

OptionDefault
--name <name>brandName of the first color
--format <format>csscss, tailwind (v4), tailwind3, tokens, json, table
--dark <mode>bothboth, media, class, none
--dark-selector <sel>.darkClass or attribute that turns dark mode on
--hexcss format: hex values instead of oklch()
--prefix <prefix>colorcss format: variable prefix
--no-neutralDo not add the tinted grey neutral
--neutral-chroma <n>autoChroma of the neutral, 0 for pure grey
--saturation <n>1Multiply the chroma of all steps
--hue-shift <deg>0Turn the hue from the lightest to the darkest step
--pinPut the exact input color on its closest step
--out <file>stdoutWrite to a file
--checkPrint failed contrast checks; exit code 1 if one fails

In CI

Keep the generated file in the repository and check it in CI when you pin your brand color:

npx @sweberdev/gradient "#e30613" --pin --check --format tailwind --out app/gradient.css
git diff --exit-code app/gradient.css