CLI Reference
The axiomatic CLI is the primary tool for generating your theme tokens.
Installation
Section titled “Installation”pnpm add -D @axiomatic-design/color# ornpm install -D @axiomatic-design/colornpx axiomatic [command] [options]Commands
Section titled “Commands”Scaffolds a new configuration file in your project.
npx axiomatic initBehavior:
- Checks if
color-config.jsonexists. - If not, creates it with the default configuration.
- If it exists, exits with an error to prevent overwriting.
generate (Default)
Section titled “generate (Default)”Generates the CSS tokens based on your configuration. If no command is specified, this is the default behavior.
npx axiomatic [config-file] [output-file]Arguments:
-
config-file(Optional)- Path to your JSON configuration file.
- Default:
./color-config.json
-
output-file(Optional)- Path where the generated CSS will be written.
- Default:
./theme.css
Examples:
# Use defaultsnpx axiomatic
# Custom config, default outputnpx axiomatic ./design/my-colors.json
# Custom config and outputnpx axiomatic ./design/my-colors.json ./src/styles/variables.cssOutput
Section titled “Output”The CLI generates a CSS file containing:
- :root Variables: Global tokens like shadows, focus rings, and data viz colors.
- Surface Classes: Classes for each surface defined in your config (e.g.,
.surface-card). - High Contrast Media Query: A
@media (prefers-contrast: more)block with accessible overrides.
Integration
Section titled “Integration”Import the generated file in your main CSS entry point:
@import "./theme.css";