6 个版本

0.3.0 2019 年 10 月 10 日
0.2.2 2019 年 4 月 8 日
0.2.1 2019 年 1 月 10 日
0.2.0 2018 年 12 月 10 日
0.1.0 2018 年 10 月 30 日

#1379解析器实现

每月 22 次下载

MIT 许可证

790KB
25K SLoC

attheme-rs

用于处理 .attheme 文件的 crate。它完全支持 .attheme 文件格式。此外,它还提供了所有默认主题,包括设置自定义强调颜色和变量列表。

如果您有任何问题或疑问,请随时在我们的 GitLab 仓库中提交问题:我们的 GitLab 仓库

安装

在您的 Cargo.toml 中添加以下内容

[dependencies]
attheme = "0.2"

示例

处理变量

use std::fs;
use attheme::{Attheme, Color};

let contents = fs::read("path/to.attheme");
let mut theme = Attheme::from_bytes(&contents[..]);

theme.variables.insert("divider".to_string(), Color::new(0, 0, 0, 0x10));

if theme.variables.get("chat_wallpaper".to_string().is_some() {
  println!("The theme has a color wallpaper");
}

提取主题的壁纸

use std::fs;
use attheme::Attheme;

let contents = fs::read("path/to.attheme");
let theme = Attheme::from_bytes(&contents[..]);

if let Some(wallpaper) = theme.wallpaper {
  fs::write("path/to/image.jpg", wallpaper);
}

文档

请参阅 docs.rs 上的文档。

依赖项

~4.5MB
~93K SLoC