color-convert
Convert color to each other by rust.
Installation
Add this to the Cargo.toml file of your project:
[]
= "0.1.0"
Don't forget to add the external crate:
extern crate color_convert;
Getting Started
extern crate color_convert;
use ;
Settings
Color has three simple configurations:
- whether it is uppercase:
upper
- whether it contains transparency:
alpha
- whether it is Android format (only hex will be used):
andriod
// ...
Features
Support RGB
,RGBA
,HEX
,HSL
,HSLA
,HSV
,CMYK
to transform each other.
Their corresponding method is to_rgb
, to_hex
, to_hsl
, to_hsv
, to_cmyk
. For formats that need to be converted to contain transparency values, you need to first set the configuration alpha to true(use method to_alpha
).
Notes
- Some values are lost when some precision values are converted to CMYK and HSV, this is the result of the algorithm, so be careful in the process of using it.
- Do not support css3 color:
transparent
andcurrentColor
.
Next
- Will support css3 color name convert to
HEX
and convert back.
Help
If you have any questions or suggestions, please contact me via issues or email.
For those who use sublime text, try a similar plugin I wrote for ColorConvert.