leonardo
leonardo copied to clipboard
Add contrast distribution to your package
Description
You've got a "Distribute" button at leonardocolor.io. However that code isn't available in the package. It'd be nice to add that to auto generate colors for some purposes.
Why do you need this feature?
Pie chart/donut chart color scheme based on number of sectors. If number of sectors reduce or increase the colors still need to cover the pallet of colors to look nice (rather than being skewed towards the first few colors of a static number of colors).
Leonardo package and version
Additional context
I've managed to extract that code from your website to an independent gist -> https://gist.github.com/Munawwar/6df560f2027f5ecb65a4281797e9ab03
My API takes number of colors to generate, a start ratio and end ratio and generates colors (and of course color keys and base color).
I generate a color scheme first using generateContrastColors() and linear ratio distribution from start ratio to end ratio. Then I take those colors and generate the final distributed colors based on the logic from the website. However this might be inefficient 2 step process.. there might be a 1 step efficient/better way to do this.