Any good cross-platform crate to create gradients?

I'm looking for a cross-platform solution for creating gradient outputs. Something like this:

There are crates that provide this feature but I'm not sure if they are cross-platform and other cross-platform coloring crates don't support gradient.

Should I even continue searching? (Maybe there is a technical problem that prevents gradients to be supported in multiple operating systems). If you know such a crate please let me know.

I've enjoyed using colorgrad for this kind of thing. The crate itself is platform independent and generates common representations of color (hex, rgba...).

If you want to print colored text to a console in a cross-platform way, I would use crossterm. You can plug in color values from colorgrad using crossterm::style::Color::Rgb.

Not all terminals support full color, so gradients are not possible in some environments. I think you would just see uncolored text in those cases, but I don't really know.

1 Like