Crates.io | irospace |
lib.rs | irospace |
version | |
source | src |
created_at | 2021-06-27 05:39:44.369359 |
updated_at | 2024-12-11 09:22:33.235933 |
description | color space and conversion method |
homepage | |
repository | |
max_upload_size | |
id | 415368 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
irospaceは、単純な色空間や色空間変換処理を提供するライブラリです。
CSS22 カラーキーワードと同等の色を定義しています。
extern crate irospace;
use irospace::{colors::Colors,
RgbColor,HsvColor,HslColor,
converter::*,
ColorConverterBuilder};
fn from_rgb_to_hsv()
{
let rgb = RgbColor::new(255,0,0);
let converter = ColorConverterBuilder::new().from_rgb().to_hsv().build();
let hsv = converter.convert(&rgb).unwrap();
// HsvColor H = 0 S = 100 V = 100 A = 255
}
fn from_rgb_to_hsl()
{
let rgb = RgbColor::new(255,0,0);
let converter = ColorConverterBuilder::new().from_rgb().to_hsl().build();
let hsl = converter.convert(&rgb).unwrap();
// HslColor H = 0 S = 100 L = 50 A = 255
}
extern crate irospace;
use irospace::{colors::Colors,
RgbColor,HsvColor,HslColor,
converter::*,
ColorConverterBuilder};
fn from_html_to_rgb()
{
let color_code = HtmlColorCode::new("#ff0000");
let converter = ColorConverterBuilder::new().from_html().to_rgb().build();
let rgb = converter.convert(&color_code).unwrap();
println!("{}",rgb);
// RgbColor R = 255 G = 0 B = 0 A = 255
}
fn from_rgb_to_html()
{
let rgb = RgbColor::new(255,0,0);
let converter = ColorConverterBuilder::new().from_rgb().to_html().build();
let html = converter.convert(&rgb).unwrap();
println!("{}",html.value_ref());
// #ff0000
}