https://github.com/zhiburt/tiny-gradient
colorful gradients for your terminal.
https://github.com/zhiburt/tiny-gradient
Last synced: 3 months ago
JSON representation
colorful gradients for your terminal.
- Host: GitHub
- URL: https://github.com/zhiburt/tiny-gradient
- Owner: zhiburt
- License: mit
- Created: 2022-07-25T13:18:19.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-25T13:40:12.000Z (almost 4 years ago)
- Last Synced: 2025-10-21T17:41:30.445Z (8 months ago)
- Language: Rust
- Size: 9.77 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
tiny-gradient
=============
[
](https://github.com/zhiburt/tiny-gradient/)
[
](https://crates.io/crates/tiny-gradient)
[
](https://docs.rs/tiny-gradient)

## Usage
```rust
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.