How esaltws/salt-theme-gen works
salt-theme-gen is a dependency-free TypeScript design-token generator. Consumers provide a primary color or curated preset, then generateTheme builds light and dark themes with semantic colors, palettes, states, elevations, scale tokens, and WCAG/APCA reports. Separate public functions adjust and compare themes, validate deserialized themes, simulate color-vision deficiencies, and export CSS, Tailwind, or DTCG formats. The graph follows documented and excerpted calls; links to unsampled but documented capabilities are cited to the README.
Main entry points: generate-theme.ts Theme generator · color-math.ts OKLCH color math · adjust-theme.ts Theme adjustment · on-colors.ts Contrast reports
Components 18
Theme generation
- Public API
src/index.ts - Theme generator
src/generate-theme.ts - Color presets
src/presets/nature-presets.ts - Theme adjustment
src/adjust-theme.ts - Theme comparison
src/diff-theme.ts - Theme validation
src/validate.ts - Generated theme
src/generate-theme.ts
Color and accessibility
- Semantic colors
src/butterfly.ts - OKLCH color math
src/color-math.ts - Contrast reports
src/on-colors.ts - Interactive states
src/state-colors.ts - Color-vision simulation
src/color-blindness.ts
Token scales
- Scale presets
src/presets - Tonal palettes
src/palettes.ts
Exports and utilities
- CSS variables
src/css-variables.ts - Tailwind config
src/tailwind.ts - DTCG tokens
src/dtcg.ts
Other components
- Library consumer
Connections 28
- Library consumer → Public API: imports
src/index.ts - Public API → Theme generator: exports
src/index.ts - Theme generator → Color presets: reads preset
src/generate-theme.ts - Theme generator → Scale presets: reads scales
src/generate-theme.ts - Theme generator → OKLCH color math: parses colors
src/generate-theme.ts - Theme generator → Semantic colors: derives colors
src/generate-theme.ts - Semantic colors → OKLCH color math: uses color math
src/butterfly.ts - Semantic colors → Contrast reports: checks contrast
src/butterfly.ts - Theme generator → Tonal palettes: builds palettes
src/generate-theme.ts - Tonal palettes → OKLCH color math: uses color math
src/palettes.ts - Theme generator → Interactive states: derives states
src/generate-theme.ts - Interactive states → OKLCH color math: uses color math
src/state-colors.ts - Interactive states → Contrast reports: corrects contrast
src/state-colors.ts - Theme generator → Contrast reports: builds reports
src/generate-theme.ts - Theme generator → Generated theme: returns theme
src/generate-theme.ts - Library consumer → Theme adjustment: adjusts theme
README.md - Library consumer → Theme comparison: compares themes
README.md - Library consumer → Theme validation: parses theme
README.md - Library consumer → Color-vision simulation: simulates colors
README.md - Library consumer → CSS variables: exports CSS
README.md - Library consumer → Tailwind config: exports config
README.md - Library consumer → DTCG tokens: exports tokens
README.md - Theme adjustment → OKLCH color math: uses color math
src/adjust-theme.ts - Theme adjustment → Contrast reports: checks contrast
src/adjust-theme.ts - Theme adjustment → Interactive states: rebuilds states
src/adjust-theme.ts - Theme adjustment → Tonal palettes: rebuilds palettes
src/adjust-theme.ts - Color-vision simulation → OKLCH color math: uses color math
src/color-blindness.ts - Color-vision simulation → Contrast reports: recomputes reports
README.md