Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get random color based on hex color from dark to light by JS?

I’m having a problem dynamically generating colors from dark to light which I’m going to use to create color differences on the pie chart.
The color refers to one of the hex colors, for example #00695C to #00897B.
How to get those colors by using javascript?

Example Image for Color Generate

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Instead of hex you can try hsl color in your project. Where you can reduce and increase intensity of l value between 0 and 100 to get different shades of light and dark. It’s more straightforward

Refer this page for more details

https://www.w3schools.com/colors/colors_hsl.asp

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading