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
690stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity4
Maintenance20
Community64
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
75/100Good
Architecture70
Code Quality78
Innovation65
Learning Curve85

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 7 apps in this directory

TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

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
TypeScript59%
Python39%
Updated today
JavaScript
53%
Other

Cosmos-Server

Security · Authentication

6,121

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
79
Repo Health
59
Technical
66
Dependency
Built with
JavaScript53%
Go43%
Updated yesterday
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

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
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
TypeScript
38%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,083

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
68
Dependency
Built with
TypeScript38%
JavaScript27%
Python25%
Updated today
Go
66%
MIT

nginx ignition

Developer Tools · Devops

2,134

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
71
Repo Health
80
Technical
75
Dependency
Built with
Go66%
TypeScript31%
Updated 4 days ago
TypeScript
52%
Other

SigNoz

Monitoring · Analytics

31,871

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
70
Dependency
Built with
TypeScript52%
Go37%
Updated today
TypeScript
59%
AGPL 3.0

Worklenz

Project Management · Product Management · Collaboration

3,148

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
67
Repo Health
7
Technical
65
Dependency
Built with
TypeScript59%
JavaScript28%
Updated 1 weeks 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

Search