A comprehensive design system with color and spacing generation based on Radix UI colors, built as a modular TypeScript monorepo with Bun.
- 12-step color progressions for each color using Radix UI methodology
- Alpha channel variants for transparency effects
- Wide gamut P3 support for modern displays
- Gray scale variants contextual to each color
- Special colors (contrast, surface, indicator)
- 26 spacing values from 0px to 80px with 4px base multiplier
- Pixel and REM variants for flexible sizing
- Utility classes for margin, padding, and gap
- Tailwind-compatible naming conventions
- Multiple output formats: CSS custom properties, JSON, design tokens, Tailwind config
- CLI tool for easy generation from any project
- TypeScript support with full type safety
- Configurable output directories and options
- Organized folder structure (colors/, spacing/, combined/)
| Package | Description | Status |
|---|---|---|
| @kevintyj/design-color-core | Core color generation logic | โ Complete |
| @kevintyj/design-spacing-core | Core spacing generation logic | โ Complete |
| Package | Description | Status |
|---|---|---|
| @kevintyj/design-color-css | CSS generation utilities | โ Complete |
| @kevintyj/design-color-json | JSON format generation | โ Complete |
| @kevintyj/design-spacing-css | Spacing CSS utilities | โ Complete |
| @kevintyj/design-spacing-json | Spacing JSON formats | โ Complete |
| Package | Description | Status |
|---|---|---|
| @kevintyj/design/cli | Command-line interface | โ Complete |
| @kevintyj/design/figma-plugin | Figma plugin for design system management | โ Complete |
| @kevintyj/design/figma-json | Export Figma variables to JSON | โ Complete |
| @kevintyj/design/examples | Usage examples and demos | โ Complete |
bun install# Build all packages in dependency order
bun run buildYour base.ts file is already set up with 9 beautiful colors and 26 spacing values:
# Validate color definitions
bun run colors:validate
# List all available colors
bun run colors:list
# Validate spacing definitions
bun run spacing:validate# Quick generation with all features
bun run system:quick
# Generate colors only
bun run colors:quick
# Generate spacing only
bun run spacing:quick
# Custom output directory
bun run system:quick --output ./dist
# Full control with all options
bun run system:generate --verbose --output ./stylesYour base.ts currently includes:
- ๐ฅ blaze - Vibrant orange-red (
#FC4B32/#FD563D) - ๐ autumn - Warm brown (
#311318/#30181B) - ๐ธ pink - Bright pink (
#F9486F/#F55776) - ๐ teal - Blue-green (
#00A77F/#17AD85) - ๐ blue - Primary blue (
#286EDC/#3A80E0) - โค๏ธ red - Classic red (
#DA3132/#DE393A) - ๐ yellow - Bright yellow (
#FBB919/#FFBD3B) - ๐ green - Fresh green (
#28B450/#51B251) - ๐ violet - Purple-blue (
#5B5BD6/#5B5BD6)
Each color generates 12-step progressions for light and dark modes with alpha variants, wide gamut P3 colors, and contextual gray scales.
Your base.ts includes 26 spacing values following a 4px multiplier system:
- Core values:
0,1(4px),2(8px),3(12px),4(16px),5(20px) - Extended values:
6through20for larger spacing needs - Pixel variants:
px(1px),2px,3px,5px,6px,10px,14px - REM equivalents: Auto-generated for all values (e.g.,
1rem= 16px)
| Command | Description | Example |
|---|---|---|
bun run system:quick |
Generate complete design system | bun run system:quick --output ./dist |
bun run colors:quick |
Quick color generation (all features) | bun run colors:quick |
bun run spacing:quick |
Quick spacing generation | bun run spacing:quick |
| Command | Description | Example |
|---|---|---|
bun run system:validate |
Validate both colors and spacing | bun run system:validate |
bun run colors:validate |
Validate color definitions | bun run colors:validate |
bun run spacing:validate |
Validate spacing definitions | bun run spacing:validate |
| Command | Description | Example |
|---|---|---|
bun run colors:list |
List all available colors | bun run colors:list |
bun run spacing:list |
List all spacing values | bun run spacing:list |
| Command | Description | Example |
|---|---|---|
bun run system:generate |
Full system generation | bun run system:generate --verbose |
bun run colors:generate |
Full control color generation | bun run colors:generate --formats css,json |
bun run spacing:generate |
Full spacing generation | bun run spacing:generate --formats css |
| Command | Description | Example |
|---|---|---|
bun run system:figma |
Generate complete Figma JSON | bun run system:figma |
bun run colors:figma |
Generate Figma color JSON | bun run colors:figma |
bun run spacing:figma |
Generate Figma spacing JSON | bun run spacing:figma |
# Generate specific formats
bun run colors:generate --formats css,json --output ./assets
# Exclude alpha channels (smaller output)
bun run colors:generate --no-alpha --output ./minimal
# Only wide gamut colors
bun run colors:generate --no-alpha --no-gray-scale --output ./p3
# Custom CSS prefix
bun run colors:generate --css-prefix "--theme" --formats css
# Pretty JSON with specific format
bun run colors:generate --json-format tokens --json-pretty --formats json
# Verbose output to see all generated files
bun run system:generate --verboseoutput/
โโโ css/
โ โโโ colors/
โ โ โโโ colors-light.css
โ โ โโโ colors-dark.css
โ โ โโโ colors-combined.css
โ โ โโโ colors-full-*.css
โ โโโ spacing/
โ โ โโโ spacing.css
โ โ โโโ spacing-px.css
โ โ โโโ spacing-rem.css
โ โ โโโ spacing-combined.css
โ โโโ combined/ # ๐ง Coming soon
โ โโโ design-system.css
โโโ json/
โ โโโ colors/
โ โ โโโ colors-flat.json
โ โ โโโ colors-nested.json
โ โ โโโ colors-tokens.json
โ โ โโโ colors-tailwind.json
โ โโโ spacing/
โ โ โโโ spacing-flat.json
โ โ โโโ spacing-nested.json
โ โ โโโ spacing-tokens.json
โ โ โโโ spacing-tailwind.json
โ โ โโโ spacing-collections.json
โ โโโ combined/ # ๐ง Coming soon
โ โโโ design-system.json
โโโ figma/
โโโ colors-figma.json
โโโ spacing-figma.json
โโโ system-figma.json # ๐ง Coming soon
import {
loadColorDefinitions,
generateColorSystem
} from '@kevintyj/design-color-core';
import { generateCSSFiles } from '@kevintyj/design-color-css';
import { generateJSONFiles } from '@kevintyj/design-color-json';
// Load from base.ts
const colorInput = await loadColorDefinitions('./base.ts');
const colorSystem = generateColorSystem(colorInput);
// Generate CSS files
const cssFiles = generateCSSFiles(colorSystem, {
includeAlpha: true,
includeWideGamut: true
});
// Generate JSON files
const jsonFiles = generateJSONFiles(colorSystem, {
format: 'all'
});import {
loadSpacingDefinitions,
generateSpacingSystem
} from '@kevintyj/design-spacing-core';
import { generateCSSFiles } from '@kevintyj/design-spacing-css';
import { generateJSONFiles } from '@kevintyj/design-spacing-json';
// Load from base.ts
const spacingInput = await loadSpacingDefinitions('./base.ts');
const spacingSystem = generateSpacingSystem(spacingInput);
// Generate CSS files
const cssFiles = generateCSSFiles(spacingSystem, {
variant: 'full',
generateUtilityClasses: true
});
// Generate JSON files
const jsonFiles = generateJSONFiles(spacingSystem, {
format: 'tailwind'
});import {
loadColorDefinitions,
loadSpacingDefinitions,
generateColorSystem,
generateSpacingSystem
} from '@kevintyj/design-color-core';
// Load definitions
const colorInput = await loadColorDefinitions('./base.ts');
const spacingInput = await loadSpacingDefinitions('./base.ts');
// Generate systems
const colorSystem = generateColorSystem(colorInput);
const spacingSystem = generateSpacingSystem(spacingInput);
// Generate combined output
const designSystem = {
colors: colorSystem,
spacing: spacingSystem,
metadata: {
generatedAt: new Date().toISOString(),
version: '1.0.0'
}
};Color Custom Properties:
:root {
/* Color scale */
--color-blue-1: #fcfdff;
--color-blue-2: #f6f9ff;
--color-blue-12: #113161;
/* Alpha variants */
--color-blue-a1: rgba(40, 110, 220, 0.05);
--color-blue-a12: rgba(40, 110, 220, 0.95);
/* Wide gamut P3 */
--color-blue-p3-1: oklch(99.4% 0.0025 259.5);
/* Special colors */
--color-blue-contrast: #ffffff;
--color-blue-surface: rgba(40, 110, 220, 0.1);
}Spacing Custom Properties:
:root {
/* Pixel values */
--spacing-0: 0px;
--spacing-1: 4px;
--spacing-2: 8px;
--spacing-4: 16px;
/* REM values */
--spacing-1-rem: 0.25rem;
--spacing-2-rem: 0.5rem;
--spacing-4-rem: 1rem;
}
/* Utility classes */
.m-1 { margin: 4px; }
.p-2 { padding: 8px; }
.gap-4 { gap: 16px; }Tailwind Colors:
{
"theme": {
"colors": {
"blue": {
"50": "#fcfdff",
"500": "#286edc",
"950": "#113161"
}
}
}
}Tailwind Spacing:
{
"theme": {
"spacing": {
"0": "0px",
"1": "4px",
"2": "8px",
"4": "16px",
"px": "1px"
}
}
}# Basic color and spacing generation example
bun run example:basic
# Advanced usage patterns
bun run example:advanced# Install dependencies
bun install
# Build all packages in dependency order
bun run build
# Build specific package
bun run build:package cli
# Clean build artifacts
bun run build:clean
# List available packages
bun run build:list# Run linting
bun run lint
# Format code
bun run precommit
# Run tests
bun run test
# Clean everything
bun run clean- Edit your
base.tsfile to add new colors:
export const light = {
// ... existing colors
brand: '#FF6B35', // Add new color
accent: '#4ECDC4'
};
export const dark = {
// ... existing colors
brand: '#FF7F59', // Add dark variant
accent: '#45B7B8'
};- Validate and generate:
bun run colors:validate
bun run colors:quick- Edit the
spacingobject inbase.ts:
export const spacing = {
// ... existing values
"24": 96, // 24 * 4px = 96px
"32": 128 // 32 * 4px = 128px
};- Generate spacing using the CLI:
bun run spacing:validate
bun run spacing:quickdesign/
โโโ packages/
โ โโโ color-generation-core/ # Core color generation
โ โโโ color-generation-css/ # Color CSS output
โ โโโ color-generation-json/ # Color JSON output
โ โโโ spacing-generation-core/ # Core spacing generation
โ โโโ spacing-generation-css/ # Spacing CSS output
โ โโโ spacing-generation-json/ # Spacing JSON output
โ โโโ cli/ # Command-line interface
โ โโโ figma-plugin/ # Figma integration
โ โโโ figma-to-json/ # Figma variable export
โ โโโ examples/ # Usage examples
โโโ base.ts # Your design definitions
โโโ package.json # Monorepo configuration
โโโ build.ts # Custom build system
โโโ output/ # Generated files
- Steps 1-2: Backgrounds, subtle borders
- Steps 3-5: UI component backgrounds
- Steps 6-8: Borders, separators
- Steps 9-10: Solid backgrounds, primary actions
- Steps 11-12: High contrast text, active states
- Micro spacing (0-4px):
0,px,2px,3px,1 - Small spacing (4-16px):
1,5px,6px,2,10px,3,14px,4 - Medium spacing (16-48px):
4,5,6,7,8,9,10,11,12 - Large spacing (48px+):
13,14,15,16,18,20
- Core:
createColorInput(),generateColorSystem(),validateColorInput() - CSS:
generateCSSFiles(),generateCSSForColorSystem() - JSON:
generateJSONFiles(),generateFlatJSON(),generateTailwindJSON()
- Core:
createSpacingInput(),generateSpacingSystem(),validateSpacingInput() - CSS:
generateCSSFiles(),generateSpacingUtilityClasses() - JSON:
generateJSONFiles(),generateTailwindSpacingJSON()
- Import/export design system configurations
- Generate color scales directly in Figma
- Manage design system variables
- Export to multiple formats
- Export Figma variables to JSON
- Convert to design system format
- Support for color and spacing variables
# Develop Figma plugin
bun run figma:dev
# Build Figma plugin for production
bun run figma:buildThis project uses a custom TypeScript build system with advanced features:
- Core Packages: Color and spacing generation cores
- Extension Packages: CSS, JSON, and Figma integrations
- Application Packages: CLI and examples
- ๐ Environment validation with Bun version checking
- ๐ฆ Dependency-aware ordering prevents build failures
- ๐จ Rich console output with colors and progress
- ๐ Parallel execution within build groups
- ๐ Build statistics with timing and performance data
- ๐งน Smart cleanup and artifact management
The build system provides detailed statistics:
- Individual package build times
- Group build summaries
- Performance rankings
- Total build time and package counts
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Build and test:
bun run build && bun run test - Run linting:
bun run lint - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
BSD 3-Clause License - see the LICENSE file for details.
- Radix UI for the color methodology
- Bun for the fast JavaScript runtime and build tools
- Tailwind CSS for spacing and utility inspiration
- All contributors to this project
- โ Complete color generation system
- โ Complete spacing generation system
- โ CLI integration for colors
- โ CLI integration for spacing
- โ Combined system generation
- ๐ง Typography scale generation
- ๐ง Component primitive generation
- ๐ง Enhanced Figma plugin with spacing support
- ๐ง Web-based design system editor
- ๐ง Design token standard compliance
- ๐ง Advanced utility class generation
- ๐ง Design system documentation site
- ๐ง VS Code extension for design system management
๐จ Ready to build beautiful, consistent design systems with automated color and spacing generation!
