#telegram #attheme

attheme

A Rust crate for parsing and serialization of .attheme files

4 releases

✓ Uses Rust 2018 edition

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

#11 in #telegram

Download history 15/week @ 2018-11-05 4/week @ 2018-11-12 5/week @ 2018-11-19 12/week @ 2018-11-26 16/week @ 2018-12-03 16/week @ 2018-12-10 4/week @ 2018-12-17 23/week @ 2018-12-24 6/week @ 2018-12-31 3/week @ 2019-01-07 16/week @ 2019-01-14

40 downloads per month

MIT license

152KB
4.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

~115KB