Note: This tool is currently in beta. It is still under active development, and features may change. Please report any issues you encounter.
shadecli
is a CLI tool for generating color palettes and updating Tailwind CSS configuration files with custom color shades. It allows developers to easily generate lighter and darker shades for a primary color and directly insert them into a Tailwind configuration file.
You can install shadecli
globally via npm:
npm install -g shadecli
Alternatively, you can install it as a development dependency in your project:
npm install --save-dev shadecli
Once shadecli
is installed, you can run it directly from the command line using the following syntax:
npx shadecli --color <base-color> --name <color-name>
--color
(required): The base color in HEX or RGB format. Example: #3490dc
.
--name
(optional): The name for the color (default is primary). This is used to generate the names for the shades (e.g., primary-50, primary-100, etc.).
By default, shadecli
will look for a tailwind.config.js
or tailwind.config.cjs
file in your project and update it with the new color shades. If no such file is found, it will create new tailwind.config.js
file with the new color shades.
To generate color shades for a #ab6655
base color and add them to the Tailwind config as customPrimary, run:
npx shadecli --color "#ab6655" --name "customPrimary"
This will generate shades for the color and add them to the tailwind.config.js file. If the file exists, shadecli
will merge the new shades with the existing configuration. It will also create a backup of the original config file, named tailwind.config.backup.js
To generate a Tailwind color palette with custom shades, run:
npx shadecli --color "#ab6655" --name "customPrimary"
This will output a Tailwind configuration with custom color shades. The behavior differs based on whether a tailwind.config.js (or tailwind.config.cjs) file already exists:
shadecli
will prompt you in the console with a yes/no question. This allows you to decide whether to replace the existing color or keep the current configuration intact.shadecli
will create a new tailwind.config.js file in the project root and add the custom color palette automatically.Here’s an example output for the configuration:
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
customPrimary: '#ab6655',
'customPrimary-50': '#eee0dd',
'customPrimary-100': '#e1c4bd',
'customPrimary-200': '#d3a99e',
'customPrimary-300': '#c48e80',
'customPrimary-400': '#b37363',
'customPrimary-500': '#9a5c4d',
'customPrimary-600': '#7a493d',
'customPrimary-700': '#5a362e',
'customPrimary-800': '#3d241f',
'customPrimary-900': '#221411',
},
},
},
};
If customPrimary already exists in the config, shadecli
will detect it and prevent overwriting by asking. This ensures existing color configurations remain intact, while new shades are added as specified.
The shadecli
tool takes a base color and generates 10 shades, ranging from lighter to darker.
It updates your Tailwind config file to include these shades, merging them with any existing color configurations.
If a tailwind.config.js file exists, shadecli
creates a backup of the original file (named tailwind.config.backup.js) before making changes.
We welcome contributions to shadecli
! If you'd like to contribute, please fork the repository and create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
GitHub Repository: https://github.com/Guccifer808/shadecli Issues: https://github.com/Guccifer808/shadecli/issues