#telegram #attheme

bin+lib attheme

A Rust crate for parsing and serialization of .attheme files

5 releases

✓ Uses Rust 2018 edition

0.2.2 Apr 8, 2019
0.2.1 Jan 10, 2019
0.2.0 Dec 10, 2018
0.1.1 Nov 24, 2018
0.1.0 Oct 30, 2018

#75 in Parser implementations

26 downloads per month

MIT license

173KB
5K SLoC

attheme-rs

A Rust crate for parsing and serialization of .attheme files.

Installing

Add this in your Cargo.toml:

[dependencies]
attheme = "0.2"

Examples

Working with variables

extern crate attheme;

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

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

theme.variables.insert("divider".to_string(), [0, 0, 0, 0x10]);

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

Extracting a theme's wallpaper

extern crate attheme;

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.


lib.rs:

A crate for working with .attheme files. It:

  • Parses .attheme;
  • Serializes .attheme;
  • Deals with both Java integers (e.g. -609399291) and HEXes (#fd5aebbb);
  • Parses wallpapers;
  • Can add themes (&theme + &other_theme) and fallback to another one (&theme | &other_theme);
  • Has the default themes.

If you think we don't support something we should or have a question, feel free to fill an issue on our GitLab repository.

Dependencies

~114KB