npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@texuli/tokens

v0.18.0

Published

The OKLCH theme engine, the --tx-* token contract, 200+ themes and compiled CSS.

Readme

@texuli/tokens

The theme engine and design tokens of Texuli, an MIT-licensed Svelte 5 component library by Dailybot, Inc. (Small pieces. Infinite possibilities.). @texuli/tokens defines the --tx-* CSS custom property contract every styled Texuli component reads, computes palettes in OKLCH, ships a library of 210 ready-made themes, generates new themes from a brand color, a mood or an image, and checks contrast against WCAG AA.

In the stack: layer L2: the token engine, on @texuli/spec (the design-system contract). The texuli components (L3), the domain packages and @texuli/astro read its --tx-* tokens.

Use it to theme the texuli components, or on its own as a framework-free token engine for any CSS (including a Tailwind 4 preset). The engine is plain TypeScript with no runtime dependencies.

Status: 0.x release. Texuli is in development. The packages are published to npm as 0.18.0, a pre-1.0 release (1.0.0 will be the first stable release). Under 0.x, a new minor (0.18.0) may contain breaking changes, so pin the exact version or use ^0.18.0, which accepts only 0.18.x.

Install

npm install @texuli/tokens
pnpm add @texuli/tokens
# or
yarn add @texuli/tokens

No peer dependencies. Import the base stylesheet once, in your app's global CSS or entry module:

@import '@texuli/tokens/base.css';
/* optional: Windows High Contrast and other forced-colors modes */
@import '@texuli/tokens/forced-colors.css';

base.css declares the tx.base and tx.components cascade layers, the system token defaults, and the reset, focus, motion and surface rules. The colors come from a theme, which you apply at runtime (below).

A host must load base.css or system.css. Since token contract v2 (0.9.0), component CSS reads the system tokens (--tx-space-unit, --tx-size-icon-sm, --tx-shape-radius-*…) with no fallback, and a theme does not declare them. A host with its own reset that loads neither renders controls with no size. A host that keeps its own reset can load the system token defaults alone (from 0.10.0):

@import '@texuli/tokens/system.css';

system.css is the same generated token block as base.css (one renderer writes both, and a test holds base.css to a superset), with no reset, motion tables or focus ring hook: 1,189 B of CSS gzip instead of 2,781 B (measured by pnpm size).

Quick start

Apply a library theme to the whole page:

import '@texuli/tokens/base.css';
import { applyTheme } from '@texuli/tokens/css';
import { loadLibraryTheme } from '@texuli/tokens/library';

loadLibraryTheme('enterprise-neutral').then((theme) => {
  applyTheme(document.documentElement, { theme, mode: 'light' });
});

applyTheme writes the validated --tx-* properties and the data-tx-theme and data-tx-mode attributes on any element, so you can also theme a single preview panel. clearTheme undoes it.

Generate a brand theme and compile it to static CSS instead:

import { compileThemeCss } from '@texuli/tokens/css';
import { generateThemeFromSeed } from '@texuli/tokens/generator';

const theme = generateThemeFromSeed({ seed: '#2f6fed', id: 'acme' });
const css = compileThemeCss(theme);
// Light and dark rules scoped to [data-tx-theme='acme'][data-tx-mode='light' | 'dark']

What's inside

| Purpose | Subpath | What it does | | --- | --- | --- | | Stylesheets | base.css, system.css, forced-colors.css, tailwind/preset.css | Base layer, the system token defaults alone (from 0.10.0), forced-colors mapping, Tailwind 4 preset | | Apply themes | css | applyTheme, clearTheme, themeVariables, compileThemeCss | | Token contract | contract | The --tx-* contract and the Theme type | | Palette engine | palette | OKLCH scales, tones and contrast pairs | | Theme library | library | 64 themes with lazy loaders: loadLibraryTheme, listThemeLibrary, searchThemeLibrary | | Expanded library | library-expand | 146 more themes (6 built-ins, then 140 curated) | | Library ids | library-ids | From 0.11.0: every library theme id (6 built-in, 64 port, 140 expand; 210) with no metadata, isLibraryThemeId and libraryThemeSet, for synchronous id checks (1.7 KB gzip) | | Single theme | build | buildLibraryTheme: build one theme from a compact definition without loading the catalog | | Theme generator | generator | generateThemeFromSeed, generateThemeFromMood, generateThemeFromImage | | Contrast gate | aa-gate, aa-gate/components | WCAG AA checks for theme and component color pairs | | Color modes | modes | Light, dark, system and high-contrast resolution: resolveColorMode, applyColorMode | | No-flash bootstrap | no-flash | noFlashScript, cacheAppearance: replay the stored theme and mode before first paint | | Forced colors | forced-colors | compileForcedColorsCss and the system-color role map | | Style presets | style-presets | Shared style presets on top of the contract | | Tailwind 4 | tailwind | Utilities mapped onto the --tx-* contract | | Motion tokens | motion | New in 0.6.0: 5 durations, 5 easings and 3 springs as data (MOTION_DURATIONS, MOTION_EASINGS, MOTION_SPRINGS), behind the --tx-motion-* properties in base.css | | System tokens | system | From 0.9.0 (token contract v2, ADR-020): 151 system tokens in 11 families (space, size, type roles, elevation, shape, layers, opacity, layout, icons, status, data-viz). base.css declares the 123 non-chart defaults once per token scope (generated); CSS reads them plainly with systemVar(name) (var(--tx-space-4)) | | Component tokens | components | From 0.9.0: the component token registry (57 components, 365 tokens: the texuli styled families plus 9 domain families). Component tokens are never declared (0 B until set): CSS reads them with componentVar(component, key), one fallback level (var(--tx-button-radius, var(--tx-shape-radius-lg))), and design systems set them on their scope. checkTokenReads guards the read forms; every texuli styled component reads its tokens, and the domain packages read theirs | | Chart tokens | data-viz | From 0.9.0: dataVizVariables(theme, mode) returns all 28 --tx-chart-* values for any theme, derived when the theme has no charts | | Renames | renames, renames.json | From 0.9.0: the machine-readable --tx-* rename list for codemods (empty: contract v2 renames nothing) | | Design systems | design-system/compile, design-system/validate | From 0.10.0 (ADR-021, ADR-022): compileDesignSystem turns a design-system document into concrete --tx-* variables per mode with enforced contrast, focus and target guarantees (refusals with codes and JSON paths), resolveDesignSystem follows extends (texuli:<id> library themes, [email protected] from your resolver), variants and patches, and fromTheme turns any Theme into a document. validate re-checks compiled maps with checkDesignSystemGuarantees. Both are lazy: the root never imports them. design-system/compile-core (from 0.11.0, G127) is the compiler without the theme library: resolveDesignSystemCore loads texuli:<id> bases only through a loadLibraryBase you pass. | | Design-system runtime | design-system/apply | From 0.10.0 (ADR-023): applyDesignSystem(el, compiled, { mode }) writes a compiled map on one element in one style write with the allowlisted attributes and [data-tx-scope], registers fonts lazily and returns a restoring dispose; designSystemStyle is the same declarations for SSR and designSystemAppearance for the no-flash replay (byte-identical, tested). Lazy, 2,040 B gzip | | Design-system I/O | design-system/import, design-system/emit, design-system/report, design-system/diff, design-system/fixtures | From 0.10.0: importers (brand one-liner, W3C DTCG, Tokens Studio, flat role palette, Texuli Theme, logo pixels) that return a valid document plus warnings and never throw; deterministic emitters (scoped CSS, Tailwind preset, DTCG, Tokens Studio, flat palette, compiled JSON); a static report page escaped by construction; diffDesignSystems (token changes per mode, contrast regressions, default changes); fictional fixtures, including a protoyard-theme/v1-shaped palette, with lossless round trips. All lazy |

The root entry (@texuli/tokens) re-exports the engine areas; the theme libraries and build stay behind their subpaths so unused themes are never bundled.

With Tailwind 4, import in this order: tailwindcss, then @texuli/tokens/tailwind/preset.css, then @texuli/tokens/base.css.

Key guarantees

  • Contrast checked. Every library theme passes the WCAG AA gate in light and dark mode; the generator can target AAA text contrast.
  • Validated values. Themes are validated before they are written or serialized, so arbitrary input cannot inject CSS.
  • No flash, CSP-friendly. The no-flash script body is deterministic for a namespace, so you can hash it for a script-src policy. It replays only allowlisted --tx-* values and fails closed on malformed cache data.
  • Accessible modes. Forced-colors mode maps every semantic role to a system color, prefers-contrast: more strengthens chrome, and prefers-reduced-motion is respected.
  • Right-to-left. Safe-area tokens have logical aliases that flip under dir="rtl".
  • SSR-friendly. No module touches window or document at import time; only the functions that write to an element or read storage do.

New in 0.6.0

Ships in 0.6.0; the 0.5.0 release predates it:

  • @texuli/tokens/motion and the --tx-motion-* properties, which reduced motion zeroes (tokens-motion).
  • Breaking: under prefers-reduced-motion: reduce, base.css sets animation and transition durations and delays to 0s (it was 0.01ms), so visibility changes are instant (G78); a 0s transition fires no transitionend.

Documentation

Related packages

Contributing

Source, issues and contribution guidelines live at github.com/DailybotHQ/texuli. Report bugs at github.com/DailybotHQ/texuli/issues.

License

MIT © Dailybot, Inc. Powered by Dailybot.