npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pengcheng789/antd-custom-theme-generator

v0.1.8

Published

A simple way to create an antd theme css file with zero configuration.

Downloads

4

Readme

Antd custom theme generator

Forked from emeks-studio/antd-custom-theme-generator.

Change: Modify the cmd path for lessc from __dirname to process.cwd().

A simple way to create an antd theme css file with zero configuration.

Ant Design provides plenty of UI components, styled with less. You can customize the default theme modifying less variable, to achive this you have multiple ways (check the doc here). The problem is that you don't have a simple way to create a static css file with zero configuration.

This project works with Antd Design v4.6.6 and aims to simplify the customization of your theme if you don't want to install dependencies, configurate things like less or eject your React project.

Usage

Generate custom theme styles

  1. Create your own custom theme with the variables that you want to override, in a file called ./custom-theme.less.

  2. Run this command to obtain a css file with your custom theme:

     $ npm -i -E --save-dev @pengcheng789/antd-custom-theme-generator

    Then generates your custom theme:

    $ generate-theme
    
    output > ./custom-theme.css
  3. Replace the import of antd/dist/antd.css in your project, with the output file (custom-theme.css) generated by this plugin.

FAQ

Q1: Which variables can I override?

The variables that are exposed by antd in this file: https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less

Also, you could use [theme] parameter in order to target to a different theme such as dark or compact (To check all available options, please inspect this folder: https://github.com/ant-design/ant-design/tree/master/components/style/themes).

Q2: Should I run this command every time i change my custom-theme.less file?

Yes, we don't provide hot-reload yet.

Q3: Is there a way of changing command defaults?

Sure, by using the command like this way:

$ generate-theme [verbose] [customThemeFilePath] [generatedThemeFilePath] [antdLibraryPath]

Default values:

  • verbose = ""
  • customThemeFilePath = "./custom-theme.less"
  • generatedThemeFilePath = "./custom-theme.css"
  • antdLibraryPath = "./node_modules/antd"
  • theme = "default"

^ Notice that all these paths must be defined relative to your project root path.

Development

Use the package locally:

$ npm link

Then in another project with antd already installed and with a custom-theme.less file created, execute:

$ generate-theme

TODO List:

  • [ ] Add hot-reload generation