6 releases

0.3.0 Oct 10, 2019
0.2.2 Apr 8, 2019
0.2.1 Jan 10, 2019
0.2.0 Dec 10, 2018
0.1.0 Oct 30, 2018

#1379 in Parser implementations

22 downloads per month

MIT license

790KB
25K SLoC

attheme-rs

A crate for working with .attheme files. It has full support for the .attheme file format. In addition, it provides all default themes, including setting custom accent colors, and a complete list of variables.

Should you have a problem or a question, feel free to file an issue on our GitLab repository.

Installation

Add this in your Cargo.toml:

[dependencies]
attheme = "0.2"

Examples

Working with variables

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");
}

Extracting a theme's 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);
}

Documentation

See the documentation on docs.rs.

Dependencies

~4.5MB
~93K SLoC