colored-rs / colored

(Rust) Coloring terminal so simple you already know how to do it !
Mozilla Public License 2.0
1.68k stars 82 forks source link

Gradients and Rainbows #151

Open B-Teague opened 1 year ago

B-Teague commented 1 year ago

Added support for two, three, or more colored gradients. Added support for rainbows.

See example output

cargo run --example colored_lists

This is mainly a first draft. Let me know if there are additional changes you want me to add, and I'll be happy to make them.

kurtlawrence commented 9 months ago

I really like the effects!

I does have some downsides with the number of allocations being done. Potentially there needs to be a different structure rather than Vec<ColoredString>, such as storing vectors of fg and bg colours which can be enumerated with the characters in ColoredString. This way it would also somewhat abstract from the implementation of ColoredString which is likely to change in v3.