DEV Community

Sakari
Sakari

Posted on

2

Converting opacity from percentage to hexadecimal in cli

I have been working on my own color theme for the past couple of weeks. As I have been working with colors a lot I realized that I was checking this really useful Hexadecimal color code for transparency gist multiple times per coding session to check what is e.g. 30% opacity in hex (btw it's 4D, I got it memorized!).

Always checking the gist became tiring and over the weekend, I created this nifty npm package to quickly convert any opacity value into hex directly from my cli.

You can install it with

npm install -g @mskri/hex-opacity
Enter fullscreen mode Exit fullscreen mode

Once installed you can then run following command in your cli to get the percentage value in hexadecimal

hex-opacity <opacity value>
Enter fullscreen mode Exit fullscreen mode

For example converting 30% opacity to hexadecimal would be

$ hex-opacity 30
4D
Enter fullscreen mode Exit fullscreen mode

Check out the package at https://www.npmjs.com/package/@mskri/hex-opacity

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay