DEV Community

Cover image for Unhex - convert colors to RGB, HEX or HSL in bulk
Arnau Espin
Arnau Espin

Posted on

Unhex - convert colors to RGB, HEX or HSL in bulk

Working on a large codebase with multiple css files, inline styles and tech lead says all colors now gotta be as HSL?

Changing 1 by 1? Forget that.

In this tutorial we will discover unhex - a nodeJS package that replaces all the colors in all the files you choose in a given directory.

Github Repository

npm link

Go to your project root directory and run npx unhex@latest a CLI inquirer will appear. Select which file extensions you wish to modify, ignore any files (like node_modules) and you are ready to go!

All the files matching your configuration will be parsed and modified to whatever color representation you chose!

Logs of running npx unhex@latest

Top comments (0)