如果你也对 rust 感兴趣,那么就去看看我写的这个color-convert插件吧,交流交流~~
使用
extern crate color_convert;
use color_convert::color::{Color, Error};
fn main() -> Result<(), Error> {
let mut color = Color::init("#c8c8c8ff", false, false, false);
// or just
let mut color = Color::new("#c8c8c8ff");
assert_eq!("rgb(200,200,200)", color.to_rgb()?);
}
目前支持RGB
,RGBA
,HEX
,HSL
,HSLA
,HSV
,CMYK
互相转化,后面会新增color name
, lab
转化.
对于sublime text 3
的用户,推荐你使用我写的另一款ColorConvert,上面的color-convert也是基于这个编辑器插件重写出来的.
后面可能还会出一个 rust 版支持命令行转化颜色值的插件,但是这个感觉需求不大,因此等哪天兴起了再说.