attheme

Crates.ioattheme
lib.rsattheme
version0.3.0
sourcesrc
created_at2018-10-30 12:46:00.742823
updated_at2019-10-10 12:18:27.059216
descriptionA crate for parsing and serialization of .attheme files.
homepage
repositoryhttps://gitlab.com/SnejUgal/attheme-rs.git
max_upload_size
id93587
size788,885
Artem Starikov (SnejUgal)

documentation

README

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.

Commit count: 82

cargo fmt