Tinterm: Tinted Terminal with Colors and Gradients
A Rust library for adding beautiful colors and gradients to your terminal output with an ergonomic API.
Features
- 🎨 RGB color support for both foreground and background
- 🌈 Smooth color gradients
- ⚡ Simple and intuitive API
- 📝 Text styling (bold, italic, underline, etc.)
- 🔄 Chainable methods
- 📚 Comprehensive documentation and examples
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0"
Quick Start
use *;
// Simple colored text
println!;
// Background color
println!;
// Gradient text
println!;
// Styled text
println!;
Color Methods
Basic Coloring
// Using descriptive names
"Text".color;
"Text".background_color;
// Using short aliases
"Text".fg;
"Text".bg;
Gradients
// Foreground gradient
"Gradient Text".gradient;
// Background gradient
"Gradient Background".gradient_bg;
// Multiline gradient with block mode
let text = "Line 1\nLine 2";
text.gradient;
Text Styling
"This line is bold".bold;
"This line is italic".italic;
"This line is underline".underline;
"This line is strikethrough".strikethrough;
"This line is dim".dim;
"This line is blink".blink;
"This line is reverse".reverse;
"This line is hidden".hidden;
"This line is bright".bright;
Method Chaining
"Styled Text"
.bold
.color
.background_color;
Predefined Colors
The library comes with several predefined colors:
RED
GREEN
BLUE
// ... and more
You can also create custom colors:
// Using RGB values (0-255)
let custom_color = new;
// Using hex values
let hex_color = from_hex.unwrap;
// or without the hash
let hex_color = from_hex.unwrap;
// Using them in text
println!;
println!;
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.