tinterm

Crates.iotinterm
lib.rstinterm
version0.2.0
created_at2024-12-12 08:03:34.405905+00
updated_at2025-09-24 19:25:37.252218+00
descriptionA powerful library for vibrant solid and gradient text with shimmer animations in terminal outputs.
homepagehttps://github.com/bratish/Tinterm
repositoryhttps://github.com/bratish/Tinterm
max_upload_size
id1480964
size103,268
Bratish Goswami (bratish)

documentation

https://docs.rs/tinterm

README

✨ Tinterm: Tinted Terminal with Shimmer Effects ✨

Crates.io Documentation License: MIT

A powerful and ergonomic Rust library for creating beautiful, colorful terminal output with stunning shimmer animations inspired by modern CLI tools.

🌟 Features

  • 🎨 Rich Colors: Full RGB support with 140+ predefined colors
  • 🌈 Smooth Gradients: Create beautiful color transitions across text
  • Shimmer Animations: Eye-catching animated effects (NEW in v0.2.0!)
  • 🎭 Text Styling: Bold, italic, underline, and more
  • 🔗 Method Chaining: Fluent, ergonomic API
  • 🚀 High Performance: Optimized for speed and low memory usage
  • 📚 Comprehensive: Extensive documentation and examples

🚀 Quick Start

Add tinterm to your Cargo.toml:

[dependencies]
tinterm = "0.2.0"

Basic usage:

use tinterm::*;

fn main() {
    // Simple colors
    println!("{}", "Hello World!".color(Color::RED));

    // Gradients
    println!("{}", "Rainbow Text".gradient(Color::RED, Color::BLUE, None));

    // ✨ NEW: Shimmer animations!
    println!("{}", "Shimmering Text".shimmer(Color::GOLD, None).static_render());

    // Chainable styling
    println!("{}", "Styled Text".bold().color(Color::GREEN).bg(Color::BLACK));
}

✨ Shimmer Animations (NEW!)

The crown jewel of tinterm v0.2.0 - beautiful animated text effects:

Basic Shimmer

use tinterm::*;

// Create a shimmering effect
let shimmer = "✨ Amazing Text ✨".shimmer(Color::GOLD, None);

// Static render for single display
println!("{}", shimmer.static_render());

// Live animation for 3 seconds
shimmer.animate(3);

Shine Effects

// Wave-like shine animation
let shine = "🌟 Sparkling Text 🌟".shine(Color::CYAN);
shine.animate(2);

Glow Effects

// Pulsing glow animation
let glow = "💫 Glowing Text 💫".glow(Color::PURPLE, 200);
glow.animate(4);

Gradient Shimmer

// Animated gradient effects
let gradient_shimmer = "🌈 Rainbow Magic 🌈"
    .shimmer_gradient(Color::RED, Color::VIOLET, None)
    .speed(150);
gradient_shimmer.animate(5);

Customization

// Customize speed, background, and intensity
let custom = "Custom Effect"
    .shimmer(Color::BLUE, Some(Color::BLACK))
    .speed(80)           // Animation speed in milliseconds
    .intensity(220);     // Effect intensity (0-255)

custom.animate(3);

🎨 Colors and Gradients

Predefined Colors

use tinterm::*;

// Use any of 140+ predefined colors (see COLORS.md for full visual reference)
println!("{}", "Fire".color(Color::RED));
println!("{}", "Ocean".color(Color::DEEP_SKY_BLUE));
println!("{}", "Forest".color(Color::FOREST_GREEN));
println!("{}", "Sunset".color(Color::ORANGE));

Custom Colors

// RGB values
let custom = Color::new(255, 128, 64);
println!("{}", "Custom Color".color(custom));

// Hex colors
let hex_color = Color::from_hex("#FF8040").unwrap();
println!("{}", "Hex Color".color(hex_color));

// Short hex
let short_hex = Color::from_hex("#F80").unwrap();
println!("{}", "Short Hex".color(short_hex));

Smooth Gradients

// Foreground gradients
println!("{}", "Gradient Text".gradient(Color::RED, Color::BLUE, None));

// Background gradients
println!("{}", "Background Gradient".gradient_bg(Color::GREEN, Color::PURPLE, None));

// Multi-line gradients
let multiline = "Line 1\nLine 2\nLine 3";
println!("{}", multiline.gradient(Color::CYAN, Color::MAGENTA, Some(true)));

🎭 Text Styling

use tinterm::*;

// Basic styling
println!("{}", "Bold Text".bold());
println!("{}", "Italic Text".italic());
println!("{}", "Underlined".underline());
println!("{}", "Strikethrough".strikethrough());

// Advanced styling
println!("{}", "Dim Text".dim());
println!("{}", "Bright Text".bright());
println!("{}", "Reversed".reverse());
println!("{}", "Blinking".blink());

// Method chaining
println!("{}",
    "Fancy Text"
        .bold()
        .italic()
        .color(Color::GOLD)
        .bg(Color::DARK_BLUE)
);

🛠️ Real-World Examples

CLI Status Indicators

use tinterm::*;

// Success, warning, error indicators
println!("Status: {} Success", "●".color(Color::GREEN));
println!("Status: {} Warning", "●".color(Color::YELLOW));
println!("Status: {} Error", "●".color(Color::RED));

// With shimmer for important notifications
println!("{}",
    "🎉 Deployment Complete!"
        .shimmer(Color::GREEN, None)
        .static_render()
);

Progress Bars

use tinterm::*;

fn show_progress(percent: usize) {
    let filled = "█".repeat(percent / 5);
    let empty = "░".repeat(20 - percent / 5);

    println!("Progress: [{}{}] {}%",
        filled.color(Color::GREEN),
        empty.color(Color::DARK_GRAY),
        percent
    );
}

show_progress(75);

Syntax Highlighting

use tinterm::*;

println!("{} {} {} {}",
    "fn".color(Color::PURPLE),
    "main".color(Color::BLUE),
    "()".color(Color::YELLOW),
    "{".color(Color::WHITE)
);

📊 Performance

Tinterm is optimized for performance:

use tinterm::*;
use std::time::Instant;

let start = Instant::now();
for i in 0..10000 {
    let _colored = format!("Line {}", i).color(Color::BLUE);
}
let duration = start.elapsed();
println!("Rendered 10,000 colored strings in: {:?}", duration);
// Typical result: ~2-5ms

🎯 Use Cases

  • CLI Tools: Status indicators, progress bars, help text
  • Development Tools: Syntax highlighting, log levels, git output
  • Games: Colorful UI, animations, effects
  • Monitoring: Dashboard displays, alerts, metrics
  • Art: ASCII art, logos, creative displays

📚 Examples

Run the included examples to see tinterm in action:

# Comprehensive feature demo
cargo run --example comprehensive_demo

# Shimmer animation showcase
cargo run --example shimmer_showcase

# CLI tools simulation
cargo run --example cli_tools

# ASCII art and creativity
cargo run --example art_and_logos

🔧 API Reference

Core Traits

  • TextModifier: Colors and text styling
  • Gradient: Gradient effects
  • Shimmer: Animation effects (NEW!)

Key Methods

  • .color(color) / .fg(color): Set foreground color
  • .bg(color): Set background color
  • .gradient(start, end, block): Apply gradient
  • .shimmer(color, bg): Create shimmer effect ✨
  • .shine(color): Create shine effect ✨
  • .glow(color, intensity): Create glow effect ✨

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Inspired by modern CLI tools with beautiful animations
  • Built with ❤️ for the Rust community
  • Special thanks to all contributors and users

Made with ✨ by Bratish Goswami

Transform your terminal output from boring to brilliant with tinterm!

Commit count: 11

cargo fmt