1 unstable release

0.1.0 Jul 25, 2022

#1119 in Command-line interface

Download history 1293/week @ 2024-07-23 1462/week @ 2024-07-30 1281/week @ 2024-08-06 708/week @ 2024-08-13 864/week @ 2024-08-20 587/week @ 2024-08-27 886/week @ 2024-09-03 798/week @ 2024-09-10 723/week @ 2024-09-17 986/week @ 2024-09-24 704/week @ 2024-10-01 868/week @ 2024-10-08 1652/week @ 2024-10-15 1253/week @ 2024-10-22 1003/week @ 2024-10-29 964/week @ 2024-11-05

4,952 downloads per month
Used in 4 crates

MIT license

23KB
557 lines

tiny-gradient

github crates.io docs.rs

Preview

Usage

use tiny_gradient::{Gradient, GradientStr, RGB};

let text = "Hello World!";

// Use custom gradient
let colored = text.gradient([RGB::new(0x01, 0x00, 0x00), RGB::new(0xDA, 0x00, 0xFF)]);
println!("{}", colored);

// Use built-in gradient.
let colored = text.gradient(Gradient::Forest);
println!("{}", colored);

Notes

All the credit should go to https://stackoverflow.com/questions/22607043/color-gradient-algorithm/.

Some insiration were taken from https://github.com/bokub/gradient-string.

There's an analogues library https://crates.io/crates/colorgrad. I wasn't aware at the begining that it exists. It seems to be more mature so you may need to take a look at it.

Dependencies

~395KB