Ant Design Colors

Generate full 10-step color palettes from a single base color, the algorithm behind Ant Design's theme system

Library
npm
v8.0.1
690 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
43 /100 Fair
Development Activity 0
Maintenance 20
Community 64
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 70
Code Quality 78
Innovation 65
Learning Curve 85

Ant Design Colors is the small TypeScript utility that powers Ant Design’s color palette generation. Given any base color, it computes a complete 10-step palette (lighter tints through the base to darker shades) by walking hue, saturation, and brightness in carefully tuned steps, matching the same visual scale used throughout the Ant Design component library. It also ships the full set of Ant Design’s preset palettes (red, volcano, gold, blue, purple, and more) plus dark-theme variants so consumers don’t need to regenerate colors that are already standardized.

Because it depends only on @ant-design/fast-color for color math, the package stays tiny and framework-agnostic — it exports plain arrays of hex strings, so any design system, theming layer, or CSS-in-JS solution can consume its output without pulling in React or any UI runtime.

What You Get

  • A generate() function that turns any base color into a 10-step light-to-dark palette using hue/saturation/brightness stepping rules
  • Dark-theme palette generation via a theme: 'dark' option that blends steps against a background color instead of just lightening/darkening
  • Pre-built presetPalettes and presetDarkPalettes objects covering all of Ant Design’s standard named colors (red, blue, green, gold, purple, etc.)
  • Each named color array also exposes a .primary property pointing at its canonical mid-tone shade
  • Zero UI framework dependency — output is plain hex strings usable in CSS variables, Tailwind config, or any styling system

Common Use Cases

  • Building a custom design system that needs Ant Design-style tonal palettes from brand colors
  • Generating light and dark theme variants of a single accent color for a themeable UI
  • Reusing Ant Design’s exact preset color scales in a non-Ant Design project for visual consistency
  • Programmatically deriving hover/active/disabled shades from a single primary color at build time

Under The Hood

Architecture - The package is a thin, pure-function core: src/generate.ts implements the palette algorithm, src/index.ts re-exports generate alongside presetPalettes/presetDarkPalettes (built by generate-presets.ts at prepare-time from a fixed list of Ant Design brand colors) and the Palette/PalettesProps types from src/types.ts. There is no class hierarchy or internal state — generate(color, opts) converts the input to HSV via @ant-design/fast-color, walks 5 lighter and 4 darker steps using fixed hue/saturation/brightness deltas (hueStep, saturationStep, brightnessStep1/2), and for dark themes blends each computed step against a background color using a hardcoded darkColorMap of index/amount pairs instead of just adjusting lightness. Tech Stack - TypeScript compiled via father (an Umi-maintained library bundler) to both CJS (lib) and ESM (es) outputs; the only runtime dependency is @ant-design/fast-color for HSV/hex color math, keeping the published bundle very small. Dev tooling uses Jest (with ts-jest) for unit tests and Vitest for benchmarking (bench/), plus @umijs/fabric ESLint config and Prettier. Code Quality - Test coverage is solid for a package this size: tests/index.test.ts snapshot-checks generated palettes for a known ‘blue’ input against Ant Design’s own published hex values (light and dark theme), tests/presets.test.ts snapshot-tests every preset palette, and tests/export.test.ts checks the public export surface. Functions are small, single-purpose, and use plain numeric constants with Chinese-language inline comments explaining the color-theory reasoning (hue rotation direction, saturation clamping bounds) — there’s no runtime error handling since inputs are simple color strings validated by the underlying color library. API Design - The public surface is deliberately minimal: one function (generate) and two data exports (presetPalettes, presetDarkPalettes), each returning plain string arrays (with a bolted-on .primary property) rather than custom classes, so consumers can drop the output straight into CSS variables, Tailwind config, or any styling system with zero framework coupling.

Used by 8 apps in this directory

TypeScript
56%
Other

agenta

AI Development · Developer Tools · Devops

4,788

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript 56%
Python 39%
Updated 5 days ago
Go
49%
Other

Cosmos-Server

Authentication · Security

6,167

All-in-one self-hosted home server with SmartShield anti-DDoS, Nebula mesh VPN, automatic HTTPS, and a 250-app marketplace — all secured behind a unified auth layer.

View details
83
Repo Health
59
Technical
64
Dependency
Built with
Go 49%
JavaScript 48%
Updated 1 weeks ago
TypeScript
92%
MIT

Dittofeed

Automation · Marketing

2,968

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
62
Dependency
Built with
TypeScript 92%
Updated 6 months ago
TypeScript
39%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,358

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 39%
JavaScript 27%
Python 25%
Updated 4 days ago
TypeScript
44%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,043

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
70
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 44%
PHP 32%
Updated 1 months ago
Go
68%
MIT

nginx ignition

Developer Tools · Devops

2,139

A modern web UI for nginx that eliminates config file editing with visual virtual hosts, SSL automation, Docker integrations, and real-time traffic analytics.

View details
69
Repo Health
80
Technical
71
Dependency
Built with
Go 68%
TypeScript 29%
Updated 1 weeks ago
TypeScript
50%
Other

SigNoz

Analytics · Monitoring

32,224

Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.

View details
92
Repo Health
83
Technical
67
Dependency
Built with
TypeScript 50%
Go 38%
Updated 4 days ago
TypeScript
65%
AGPL 3.0

Worklenz

Collaboration · Product Management · Project Management

3,191

All-in-one open source project management for teams who want full control — plan projects, track tasks, manage resources, and monitor finances without the SaaS lock-in.

View details
86
Repo Health
7
Technical
64
Dependency
Built with
TypeScript 65%
JavaScript 23%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers