Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Ant Design
  3. antd-theme-generator

antd-theme-generator

JavaScript

Generate dynamic theme files for Ant Design by processing LESS variables to enable runtime color changes.

Visit WebsiteGitHubGitHub
358 stars84 forks0 contributors

What is antd-theme-generator?

antd-theme-generator is a Node.js script that generates a color.less file from Ant Design's LESS variables, enabling dynamic theme changes in the browser. It processes custom LESS files and extracts theme variables to create a stylesheet that can be updated at runtime without a full rebuild.

Target Audience

Frontend developers using Ant Design who need to implement dynamic theme switching or runtime color customization in their applications.

Value Proposition

It provides a lightweight solution for dynamic theming with Ant Design by generating optimized color stylesheets, avoiding the need for complex build processes or manual LESS compilation during runtime theme updates.

Overview

This script is to generate color.less file to update color related css in browser.

Use Cases

Best For

  • Implementing dynamic theme switching in Ant Design applications
  • Generating runtime-updatable color stylesheets from LESS variables
  • Customizing Ant Design themes without rebuilding the entire CSS
  • Creating theme preview features with live color changes
  • Extracting color-related styles from custom LESS files for dynamic theming
  • Building applications with user-selectable color schemes using Ant Design

Not Ideal For

  • Projects not using Ant Design or LESS for styling
  • Applications requiring server-side rendering without client-side JavaScript for themes
  • Teams seeking a zero-configuration theme solution with minimal setup
  • High-performance apps where client-side LESS compilation overhead is unacceptable

Pros & Cons

Pros

Dynamic Runtime Updates

Enables live theme color changes in the browser using less.js, as shown with window.less.modifyVars, allowing users to update themes without rebuilding CSS.

Custom Variable Support

Processes user-defined LESS files and variables through options like varFile and themeVariables, facilitating deep customization of Ant Design themes.

Flexible Color Detection

Includes default regex for color functions and allows customColorRegexArray, ensuring accurate extraction of complex color values from LESS files.

Output Flexibility

Can write generated styles to outputFilePath or return them programmatically, offering adaptability for various build and deployment workflows.

Cons

Client-Side LESS Dependency

Requires loading less.js in the browser for runtime updates, adding JavaScript overhead and potential compatibility issues with modern frameworks.

Limited to LESS Ecosystem

Only works with LESS-based projects, making it unsuitable for teams using SASS, CSS-in-JS, or vanilla CSS, which limits its versatility.

Configuration Complexity

Manual setup of paths, variable files, and regex patterns can be error-prone and requires a good understanding of Ant Design and LESS structure.

Frequently Asked Questions

Quick Stats

Stars358
Forks84
Contributors0
Open Issues23
Last commit3 years ago
CreatedSince 2018

Tags

#ant-design#frontend-tooling#dynamic-theming#less#theme-generation#css-preprocessor

Built With

N
Node.js
L
Less

Links & Resources

Website

Included in

Ant Design3.3k
Auto-fetched 1 day ago

Related Projects

antd-theme-webpack-pluginantd-theme-webpack-plugin

A webpack plugin for Dynamic theme generation for Ant Design

Stars366
Forks73
Last commit3 years ago
dynamic-antd-themedynamic-antd-theme

🌈 A simple plugin to dynamic change ant-design theme whether less or css.

Stars245
Forks29
Last commit3 years ago
storybook-addon-customize-antd-themestorybook-addon-customize-antd-theme

a Storybook addon help you visually customize an ant design theme

Stars32
Forks2
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub