| Crates.io | color_scaling |
| lib.rs | color_scaling |
| version | 0.1.0 |
| created_at | 2015-12-26 20:46:33.474114+00 |
| updated_at | 2025-09-15 21:20:11.608799+00 |
| description | Functions to scale colors: get a weighted color between 2 colors |
| homepage | |
| repository | https://github.com/borisfaure/color_scaling.rs/ |
| max_upload_size | |
| id | 3762 |
| size | 38,671 |
Functions to get a weighted color between 2 colors. For example, to generate a gradient between 2 colors.
This crate is fully compatible with Cargo. Just add it to your Cargo.toml:
[dependencies]
color_scaling = "*"
extern crate color_scaling;
extern crate image;
use color_scaling::scale_rgb;
use image::Rgb;
fn main() {
let white : Rgb<u8> = Rgb{ data: [255, 255, 255] };
let orange : Rgb<u8> = Rgb{ data: [255, 127, 0] };
let light_orange = scale_rgb(&white, &orange, 0.8_f64);
println!("light_orange={:?}", light_orange);
}