A Rust library for colorizing console output with cute gradients
1# cutify
2
3[](https://crates.io/crates/cutify)  [](https://docs.rs/cutify/latest/cutify/)
4
5A Rust library for colorizing console output with cute gradients.
6
7
8
9## Features
10
11- Extension trait API (`"text".gradient()`)
12- Builder API (`Cutifier::new()`)
13- Stateful API for persistent gradients
14- Built-in color palettes
15- Hue range filtering
16- Gradient directions
17- Configurable parameters
18- Custom writer support
19
20> [!NOTE]
21> Windows Compatibility
22> - These features require Windows 10+ or a modern terminal
23> - Stateful API: `cute!()`, `cuteprintln!()`, `cuteprint!()` macros
24> - Extension trait API: `Display` formatting of `CutifiedString`
25
26## Usage
27
28### Extension Trait API
29
30```rust
31use cutify::Cutify;
32
33println!("{}", "Hello World".gradient());
34println!("{}", "Pastel colors".pastel());
35println!("{}", "Ocean vibes".ocean());
36println!("{}", "Only purples".purples());
37```
38
39### Builder API
40
41Fine-grained control with method chaining:
42
43```rust
44use cutify::{Cutifier, ColorPalette, GradientDirection};
45
46Cutifier::new("Custom gradient")
47 .palette(ColorPalette::Sunset)
48 .direction(GradientDirection::Diagonal)
49 .hue_shift(15.0)
50 .print();
51
52// Write to custom buffer
53let mut buffer = Vec::new();
54Cutifier::new("To buffer")
55 .palette(ColorPalette::Fire)
56 .write_to(&mut buffer)?;
57```
58
59### Stateful API
60
61Continue gradients across multiple prints:
62
63```rust
64use cutify::{cuteprintln, cute};
65
66cuteprintln!("This continues");
67cuteprintln!("the same gradient");
68let colored = cute!("across calls");
69```
70
71## Options
72
73- `palette(ColorPalette)` - Apply predefined color scheme
74- `hue_range(HueRange)` - Limit colors to specific hue range
75- `direction(GradientDirection)` - Set gradient direction
76- `saturation(f32)` - Adjust color saturation (0.0-1.0)
77- `lightness(f32)` - Adjust color lightness (0.0-1.0)
78- `hue_shift(f32)` - How much the hue changes per step (degrees, default: 12.0)
79- `step(f32)` - How often the color changes (characters per step, default: 1.0)
80 - `step(3.0)` means every 3rd character gets a new color
81 - Combine with `hue_shift` for control: `step(2.0).hue_shift(30.0)` = big color jumps every 2 chars
82- `scale(f32)` - Alternative to hue_shift: characters for full gradient cycle (e.g., 10.0=completes in 10 chars, 0=disabled)
83- `base_hue(f32)` - Set starting hue (0-360)
84- `random_hue()` - Randomize base hue
85- `reverse()` - Reverse gradient direction
86
87## Examples
88
89Run examples:
90```bash
91cargo run --example demo
92```
93
94
95
96## License
97
98MIT