adobe / adobe/leonardo

Add contrast distribution to your package

Open
#44 0 comments 0 reactions 0 assignees View on GitHub
enhancement npm packages
Dominant language
JavaScript
Stars
2.1k
Forks
130
PR merge metrics
No merged PRs in 30d

Description

## 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.

Contributor guide

Open the contributing guide

Research direction

Review the existing package API around generateContrastColors() and compare it with the extracted website logic in the linked gist. Determine how a requested number of colors and start/end ratios should produce a palette covering the color range, then verify the result for pie and donut chart sector counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
accessibility, design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.