Targ Apps Docs
Chroma-Style

Chroma-Style

@chroma/style — design tokens, tw() class merging, prose typography and cva presets for Chroma apps; its utility CSS generator is the native chroma-style build plugin of the Chroma CLI.

Chroma-Style (@chroma/style, plugin name chroma-style) is how Chroma apps get a shared visual language without npm, without a CSS toolchain. It ships as a browser plugin plus a build plugin inside the CLI, in three parts:

  1. Tokens — shadcn-compatible CSS variables (--background, --primary, --radius…), light and dark.
  2. A generator — the native chroma-style build plugin of the Chroma CLI (no Node, no script in your project) that scans your .chr/.html files for class names and emits only the CSS those classes need, layered and readable.
  3. Runtime helpers — twMerge()/tw() to merge classes with conflict resolution, and cva presets (button, badge, card, input) built on the WASM engine's cva and cx.

Problem it solves: Chroma UI is plain DOM nodes with class strings. Chroma-Style gives those strings a vocabulary (flex items-center gap-4 md:grid-cols-3 hover:bg-primary/80) that the generator turns into a small, ordered stylesheet — and that twMerge() can override in components, the way shadcn's cn() does.

Plugin namechroma-style
Package@chroma/style (v0.3.0)
loadAs keyplugins.style from loadPlugins()
LicenseGPL-3.0-or-later — © Targ Apps

What is in the package

ArtifactPurpose
tokens.cssLight/dark palettes, semantic colors, radius scale, fonts, text scale, shadows, motion variables (layer tokens)
base.cssReset and base styles (layer base)
lib/The class grammar in JavaScript: tw.js uses it in the browser to know which CSS properties a class sets. The build-time generator is the native chroma-style build plugin — Utilities
tw.jstwMerge() / tw() — class merge with conflict resolution
prose.cssTypography for long-form content (prose, `prose-sm
animate.css@keyframes (spin, marquee, accordion, enter/exit…), included only when a class references them
components.csscs-* shells, focus-ring, is-disabled, [data-animate] hooks
utilities.cssGenerated starter subset for apps that do not use the generator
variants.jscreateVariants(cva) → button, badge, card, input
index.jsbootstrapStyle, injectStyles, twMerge, tw, createTw, utilityClasses, default plugin export
chroma.plugin.jsonManifest (loadAs: "style", hooks.styles)

Quick start

// chroma.json (excerpt)
{ "plugins": ["chroma-style"] }
// src/main.chr
import { render, cva, cx } from "../pkg/chroma.js";
import { bootstrapStyle } from "../plugins/chroma-style/index.js";
import { App } from "./App.chr";

// styles:false — the HTML already links the CSS generated by the chroma-style build plugin
globalThis.__chromaStyle = bootstrapStyle({ cva, cx, styles: false });

render(App, document.getElementById("app"));
{
  "plugins": ["chroma-style"],
  "pluginOptions": { "chroma-style": { "src": ["src", "index.html"], "output": "assets/css/app.css" } }
}

chroma dev and chroma build generate assets/css/app.css (link it from index.html); see chroma-style build plugin.

// Any component
const { presets, tw } = globalThis.__chromaStyle;

e("button", { class: presets.button({ variant: "primary", size: "sm" }) }, "Save");
e("p", { class: tw("text-muted-foreground text-sm", props.class) }, "Caption");

End-to-end narrative, patterns, and troubleshooting: Styling guide. A real app built this way: Targ Apps in Chroma — Styles.

Documentation map

PageContents
As a pluginManifest, loader styles hook, vendoring, how chroma build treats the plugin, the CSS build step
TokensBrand --cs-* layer, semantic tokens, scales, light/dark theming
UtilitiesThe generator: CLI, utility grammar, variants, prose, animations, twMerge, extending
PresetsVariant tables and composition patterns
Runtime hostsPortable (Web) vs Executable (Desktop) for CSS

When to reach for something else

  • Large component libraries — Chroma-Style gives you tokens, utilities and four presets; shadcn-style components (button.chr, badge.chr…) are written in your app with cva + twMerge.
  • Global animation libraries — Use legacy libraries (CDN UMD) or vendored ESM (GSAP) with the [data-animate] hooks and animate-* classes; there is no npm CSS pipeline.

Next

On this page