@cssints/tokens

Ready-made token sets for cssints, one subpath export per set. Each set is plain DTCG data (as const) that you pass to createTokens yourself, and dark values are override objects for createGlobalTheme. The data is generated from upstream packages and files at a pinned version (bun run generate). The package has no runtime and no scope().

// tokens.ts
import { createTokens } from "cssints" with { type: "cssints" };
import { colors, easings, radii, shadows, sizes } from "@cssints/tokens/open-props";
import { light } from "@cssints/tokens/radix";

export const op = createTokens({
  ...colors,
  size: sizes,
  radius: radii,
  ease: easings,
  shadow: shadows,
});
export const rx = createTokens({ radix: { blue: light.blue, gray: light.gray } });
// theme.ts, imported once by the entry
import { createGlobalTheme, media } from "cssints" with { type: "cssints" };
import { shadowsDark } from "@cssints/tokens/open-props";
import { dark } from "@cssints/tokens/radix";

import { op, rx } from "./tokens.ts";

const scheme = media("(prefers-color-scheme: dark)");
createGlobalTheme(rx.radix, scheme, { blue: dark.blue, gray: dark.gray });
createGlobalTheme(op.shadow, scheme, shadowsDark);
// card.ts
import {
  boxShadow,
  cn,
  color,
  p,
  transitionTimingFunction,
} from "cssints" with { type: "cssints" };

import { op, rx } from "./tokens.ts";

export const card = cn(
  p(op.size._3),
  color(rx.radix.blue._11),
  boxShadow(op.shadow.shadow2),
  transitionTimingFunction(op.ease.easeOut3),
);

The sheet of card.ts holds the four tokens the module uses, of the 384 that tokens.ts makes. Easings and shadows have no @property syntax of their own, so their rule takes any value (syntax: "*"). The sheet of theme.ts holds the dark rules:

@property --ease-ease-out3 {
  syntax: "*";
  inherits: true;
  initial-value: cubic-bezier(0, 0, 0.3, 1);
}
@property --radix-blue-11 {
  syntax: "<color>";
  inherits: true;
  initial-value: #0d74ce;
}
@property --shadow-shadow2 {
  syntax: "*";
  inherits: true;
  initial-value:
    0 3px 5px -2px hsl(220 3% 15% / 4%),
    0 7px 14px -5px hsl(220 3% 15% / 6%);
}
@property --size-3 {
  syntax: "<length>";
  inherits: true;
  initial-value: 16px;
}
@layer _.a {
  ._16gq2dh {
    padding: var(--size-3);
  }
  ._6lyfev {
    transition-timing-function: var(--ease-ease-out3);
  }
  ._jwbgq6 {
    color: var(--radix-blue-11);
  }
  ._lwcu7u {
    box-shadow: var(--shadow-shadow2);
  }
}
@layer _.k {
  @media (prefers-color-scheme: dark) {
    :root {
      --radix-blue-1: #0d1520; /* ... */
      --radix-gray-12: #eeeeee;
    }
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --shadow-shadow1: 0 1px 2px -1px hsl(220 40% 2% / 34%); /* ... */
    }
  }
}

The sets

Import Exports From
@cssints/tokens/open-props colors, sizes, remSizes, fluidSizes, contentSizes, headerSizes, relativeSizes, radii, borderSizes, fontSizes, fluidFontSizes, letterSpacings, fontWeights, lineHeights, easings, springs, shadows (tokens); shadowsDark (overrides) open-props 1.7.23
@cssints/tokens/radix light, lightAlpha (tokens); dark, darkAlpha (overrides) @radix-ui/colors 3.0.0
@cssints/tokens/flexoki flexoki (base: black, paper, 50..950; eight accents 50..950) kepano/flexoki@8d723ba
@cssints/tokens/reasonable-colors reasonableColors (25 hues, shades 1..6) reasonable-colors 0.4.0

Contrast

check.contrast reads the defaults and every theme. With the Radix sets, the text steps on the backgrounds give these results (test/fixtures/radix-theme.ts checks all 31 scales, light and dark):

Limits

Licenses

The code is MIT (LICENSE). The data keeps the license of its source:

The MIT notice of each source, with its copyright line above:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cd packages/tokens && bun run generate   # src/*.ts from the devDependencies and the pinned files, then vp fmt
cd packages/tokens && bun run test       # a fixture per set through the engine (sheets, Radix theme and contrast); bun run typecheck: the type test