EmmanuelDodoo / modav

Data Visualization tool written in Rust and with Iced
2 stars 1 forks source link

Gradual Color Engine #15

Closed EmmanuelDodoo closed 2 months ago

EmmanuelDodoo commented 2 months ago

The current implementation of gradual colors by the color engine produces colors which quickly become indistinguishable. On a dark theme, the resulting colors tend to approach black. A better implementation is needed to make successive colors distinguishable for longer.

Example on a light theme image The difference between the 3rd bar and it's immediate neighbours is almost negligible.

Example on a dark theme image The colors after the 2nd bar tend toward black quickly

EmmanuelDodoo commented 2 months ago

My current thinking is to either increase or decrease the brightness of the color (using HSV here) based on which direction has more 'space'.

The change would then be a fraction of the original space. Should the change be a fraction of the remaining space instead, successive colors would become more and more indistinguishable, which would being as back to point one.

EmmanuelDodoo commented 2 months ago

These are the results of above approach.

Light theme image

Dark theme image

EmmanuelDodoo commented 2 months ago

Another approach would be to generate the seed, then turn down/up the brightness based on light/dark theme. Any generated colors would then turn up/down the brightness.

Would look like this image

EmmanuelDodoo commented 2 months ago

For both of these, I think an idea of how many colors to produce will be necessary. That way brightness changes can be spread more evenly

Fixed: 2ddc82cad335669fc8490ca54c58e38c67f12b8c

EmmanuelDodoo commented 2 months ago

The second implementation will handle more generated colors better. I think I'll stick with that

EmmanuelDodoo commented 2 months ago

Second approach implemented and pushed to main

0e3d5bbef900a45faae51bf83c356533e6eb8e2b