Rustint
Rustint is a Rust library for working with RGB colors. It provides a simple and efficient way to create, manipulate, and convert colors in Rust applications.
Features
- Create RGB colors
- Interpolate between two colors
- Convert hexadecimal color strings to RGB
- Convert RGB colors to hexadecimal strings
- Error handling for invalid color formats
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0"
Usage
Creating a Color
use Color;
let red = new;
let blue = new;
// or
let red = try_from.unwrap;
let blue = try_from.unwrap;
Interpolating Between Colors
let red = new;
let blue = new;
let purple = red.interpolate;
println!; // Outputs: Purple: #7F007F
Converting to Hex String
let color = new;
println!; // Outputs: Hex: #804020
Error Handling
The library provides custom error types for handling invalid color formats:
use ;
let result = try_from;
match result
License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.