Skip to content

mxve/cutify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cutify

Crates.io Version CI Docs.rs

A Rust library for colorizing console output with cute gradients.

cutify

Features

  • Extension trait API ("text".gradient())
  • Builder API (Cutifier::new())
  • Stateful API for persistent gradients
  • Built-in color palettes
  • Hue range filtering
  • Gradient directions
  • Configurable parameters
  • Custom writer support

Note

Windows Compatibility

  • These features require Windows 10+ or a modern terminal
    • Stateful API: cute!(), cuteprintln!(), cuteprint!() macros
    • Extension trait API: Display formatting of CutifiedString

Usage

Extension Trait API

use cutify::Cutify;

println!("{}", "Hello World".gradient());
println!("{}", "Pastel colors".pastel());
println!("{}", "Ocean vibes".ocean());
println!("{}", "Only purples".purples());

Builder API

Fine-grained control with method chaining:

use cutify::{Cutifier, ColorPalette, GradientDirection};

Cutifier::new("Custom gradient")
    .palette(ColorPalette::Sunset)
    .direction(GradientDirection::Diagonal)
    .hue_shift(15.0)
    .print();

// Write to custom buffer
let mut buffer = Vec::new();
Cutifier::new("To buffer")
    .palette(ColorPalette::Fire)
    .write_to(&mut buffer)?;

Stateful API

Continue gradients across multiple prints:

use cutify::{cuteprintln, cute};

cuteprintln!("This continues");
cuteprintln!("the same gradient");
let colored = cute!("across calls");

Options

  • palette(ColorPalette) - Apply predefined color scheme
  • hue_range(HueRange) - Limit colors to specific hue range
  • direction(GradientDirection) - Set gradient direction
  • saturation(f32) - Adjust color saturation (0.0-1.0)
  • lightness(f32) - Adjust color lightness (0.0-1.0)
  • hue_shift(f32) - How much the hue changes per step (degrees, default: 12.0)
  • step(f32) - How often the color changes (characters per step, default: 1.0)
    • step(3.0) means every 3rd character gets a new color
    • Combine with hue_shift for control: step(2.0).hue_shift(30.0) = big color jumps every 2 chars
  • scale(f32) - Alternative to hue_shift: characters for full gradient cycle (e.g., 10.0=completes in 10 chars, 0=disabled)
  • base_hue(f32) - Set starting hue (0-360)
  • random_hue() - Randomize base hue
  • reverse() - Reverse gradient direction

Examples

Run examples:

cargo run --example demo

demo

License

MIT

About

A Rust library for colorizing console output with cute gradients

Topics

Resources

License

Stars

Watchers

Forks

Languages