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

saltcat-design-system-unocss-preset

v0.2.1

Published

UnoCSS preset based on Wind4 preset with saltcat-design-system configuration

Readme

saltcat-design-system-unocss-preset

UnoCSS preset that integrates the saltcat design system with the Wind4 preset, providing a seamless way to use design tokens in your UnoCSS configuration with advanced features like automatic palette generation, easing functions, and accessibility support.

Features

  • Design System Integration: Automatically converts saltcat design system tokens to UnoCSS theme configuration
  • Wind4 Compatibility: Built on top of the popular @unocss/preset-wind for full utility coverage
  • Flexible Configuration: Customizable prefix/postfix for design system tokens
  • TypeScript Support: Full TypeScript definitions included
  • Theme Support: Supports multiple themes from the design system
  • Automatic Palette Generation: Generate color palettes using saltcat-color-palette (optional)
  • Easing Functions: Add smooth animation easing using saltcat-easing (optional)
  • Accessibility Features: Built-in contrast checking and WCAG compliance (optional)
  • Multi-Theme Support: Light/dark mode and custom theme variants

Installation

npm install saltcat-design-system-unocss-preset

Peer Dependencies

This preset requires the following peer dependencies:

npm install unocss@^66.1.2 saltcat-design-system@^0.2.0

Optional Dependencies

For enhanced features, you can install optional dependencies:

# For automatic color palette generation
npm install saltcat-color-palette@^0.3.0

# For easing functions in animations
npm install saltcat-easing@^0.2.1

Usage

Basic Usage

import { defineConfig } from 'unocss'
import { presetDesignSystem } from 'saltcat-design-system-unocss-preset'

export default defineConfig({
  presets: [
    presetDesignSystem()
  ]
})

With Design System Configuration

import { defineConfig } from 'unocss'
import { presetDesignSystem } from 'saltcat-design-system-unocss-preset'
import DesignSystem from 'saltcat-design-system'

const ds = new DesignSystem({
  tokens: {
    colors: {
      primary: '#0066cc',
      secondary: '#6c757d'
    },
    spacing: {
      small: '0.5rem',
      medium: '1rem',
      large: '2rem'
    }
  }
})

export default defineConfig({
  presets: [
    presetDesignSystem({
      designSystem: ds,
      prefix: 'ds',
      postfix: ''
    })
  ]
})

Advanced Configuration

import { defineConfig } from 'unocss'
import { presetDesignSystem } from 'saltcat-design-system-unocss-preset'
import DesignSystem from 'saltcat-design-system'

const designSystem = new DesignSystem({
  // Your design system configuration
})

export default defineConfig({
  presets: [
    presetDesignSystem({
      designSystem,
      prefix: 'my',        // Custom prefix for tokens
      postfix: '-custom',  // Custom postfix for tokens
      windOptions: {       // Options passed to @unocss/preset-wind
        dark: 'class'      // Enable dark mode with class strategy
      },
      palette: {           // Enable automatic palette generation
        enabled: true,
        algorithm: 'analogous',
        shades: 9
      },
      easing: {            // Enable easing functions
        enabled: true,
        functions: ['ease-in-out', 'ease-in', 'ease-out']
      },
      accessibility: {     // Enable accessibility features
        enabled: true,
        minContrastRatio: 4.5
      },
      theme: {             // Enable multi-theme support
        enabled: true,
        themes: ['light', 'dark'],
        defaultTheme: 'light'
      }
    })
  ]
})

API

presetDesignSystem(options?)

Creates an UnoCSS preset that combines the Wind4 preset with design system tokens and optional advanced features.

Parameters

  • options (optional): Configuration object
    • designSystem (optional): DesignSystem instance from saltcat-design-system
    • prefix (optional, default: 'ds'): Prefix for design system tokens
    • postfix (optional, default: ''): Postfix for design system tokens
    • windOptions (optional): Options to pass to the underlying Wind preset
    • palette (optional): Palette generation options
      • enabled (boolean, default: false): Enable automatic palette generation
      • shades (number, default: 9): Number of shades to generate per color
      • algorithm (string, default: 'analogous'): Palette generation algorithm
    • easing (optional): Easing function options
      • enabled (boolean, default: false): Enable easing functions
      • functions (string[], default: ['ease-in-out', 'ease-in', 'ease-out']): Easing functions to include
    • accessibility (optional): Accessibility options
      • enabled (boolean, default: false): Enable accessibility features
      • minContrastRatio (number, default: 4.5): Minimum contrast ratio for WCAG AA compliance
    • theme (optional): Theme options
      • enabled (boolean, default: false): Enable multiple theme support
      • defaultTheme (string, default: 'light'): Default theme name
      • themes (string[], default: ['light', 'dark']): Available themes

Returns

Promise

Example

const preset = presetDesignSystem({
  designSystem: myDesignSystem,
  prefix: 'brand',
  postfix: '-token'
})

Configuration Options

Design System Integration

When a designSystem instance is provided, the preset will:

  • Extract colors, typography, spacing, and other design tokens
  • Convert them to UnoCSS theme format
  • Merge with the Wind4 preset theme
  • Make tokens available as CSS variables and utility classes

Token Mapping

Design system tokens are mapped to UnoCSS theme categories:

  • colors.*theme.colors
  • fontFamily.*theme.fontFamily
  • fontSize.*theme.fontSize
  • spacing.*theme.spacing
  • borderRadius.*theme.borderRadius
  • boxShadow.*theme.boxShadow
  • borderWidth.*theme.borderWidth
  • lineHeight.*theme.lineHeight
  • letterSpacing.*theme.letterSpacing

Prefix/Postfix Customization

// With prefix: 'brand' and postfix: '-v2'
presetDesignSystem({
  designSystem: ds,
  prefix: 'brand',
  postfix: '-v2'
})

// Results in tokens like:
// brand-primary-v2, brand-secondary-v2, etc.

Advanced Features

Palette Generation

When palette.enabled is true, the preset will automatically generate color palettes for each color in your design system:

presetDesignSystem({
  designSystem: ds,
  palette: {
    enabled: true,
    algorithm: 'complementary', // 'analogous', 'complementary', 'triadic', 'split-complementary'
    shades: 12 // Number of shades to generate
  }
})

This adds a palettes object to your theme containing generated color variations.

Easing Functions

When easing.enabled is true, the preset includes easing functions for smooth animations:

presetDesignSystem({
  designSystem: ds,
  easing: {
    enabled: true,
    functions: ['ease-in-out', 'ease-in', 'ease-out', 'ease-elastic']
  }
})

This adds an easing object to your theme with CSS easing function values.

Accessibility Features

When accessibility.enabled is true, the preset performs contrast checking:

presetDesignSystem({
  designSystem: ds,
  accessibility: {
    enabled: true,
    minContrastRatio: 4.5 // WCAG AA standard
  }
})

This adds an accessibility object with contrast compliance information.

Multi-Theme Support

When theme.enabled is true, the preset supports multiple themes:

presetDesignSystem({
  designSystem: ds,
  theme: {
    enabled: true,
    themes: ['light', 'dark', 'high-contrast'],
    defaultTheme: 'light'
  }
})

This adds themes and defaultTheme to your theme configuration.

Dependencies

  • saltcat-design-system: Core design system library
  • @unocss/preset-wind: Underlying Wind4 preset
  • saltcat-color-palette (optional): Automatic color palette generation
  • saltcat-easing (optional): Easing functions for animations

Requirements

  • Node.js >= 14.0.0
  • UnoCSS >= 66.1.2
  • saltcat-design-system >= 0.2.0
  • saltcat-color-palette >= 0.3.0 (optional)
  • saltcat-easing >= 0.2.1 (optional)

License

MIT