tw-alchemist
v1.3.1
Published
<br/> <div align="center"> <a href="https://github.com/einenlum/tailwind-alchemist"> <img src="images/logo.png" alt="Logo" width="80" height="80"> </a> <h3 align="center">Tailwind Alchemist 🪄</h3> <p align="center"> A CLI tool to manage and replace Tailw
Readme
If you’ve ever wanted to:
- Check all the Tailwind default colors used in your project.
- Replace existing colors with new ones while maintaining consistency.
...then Tailwind Alchemist is for you 🪄
Installation
No need to install it, you can run it with npx.
Usage
All commands require at least one option -p or --pattern to know where to look for.
- Example with one pattern:
-p 'resources/views/**' - Example with multiple patterns:
-p 'resources/views/**' -p 'my/other/folder/**'
Scan for Tailwind Default Colors
To scan your project for Tailwind default colors:
npx tw-alchemist scan -p 'resources/views/**' -p 'some/other/folder/**'Options:
-v: Display the files where the colors are found.
npx tw-alchemist scan -p 'resources/views/**' -v-vv: Display the files and matches where the colors are found.
npx tw-alchemist scan -p 'resources/views/**' -vvScan for a specific color (even a custom one)
npx tw-alchemist scan indigo-800 -p 'resources/views/**' -vvReplace Colors
To replace an existing color with another one:
npx tw-alchemist replace oldColor newColor -p 'resources/views/**'To check what would be done without touching files, use --dry-run:
npx tw-alchemist replace oldColor newColor -p 'resources/views/**' --dry-runNotes:
- If
newColordoesn’t exist in your Tailwind config, the tool will print the necessary CSS for you to add. - If
oldColoris one of Tailwind’s default colors, the tool will use its OKLCH value for accurate replacement.
Compatibility
Only compatible with TailwindCSS 4.x.
Should work more or less on TailwindCSS 3.x.
Disclaimer
This tool is not affiliated with Tailwind CSS or its creators. It’s a personal project built to help developers manage their Tailwind CSS colors.
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
Author
Yann Rabiller (@einenlum). You can check my blog and my book From PHP to Python.
License
This project is licensed under the MIT License. See the LICENSE file for details.
