#egui #style #themes #container #applications #serializable #standalone

egui-theme

A standalone serializable theme container for use with Egui

5 unstable releases

0.2.0 Jun 4, 2022
0.1.1 Oct 30, 2021
0.1.0 Sep 24, 2021
0.0.5 Sep 10, 2021
0.0.4 Sep 6, 2021

#1446 in Encoding


Used in egui-stylist

MIT license

655KB
1K SLoC

Rust 700 SLoC // 0.0% comments Rusty Object Notation 434 SLoC

egui-theme: A container for reproducible styles and visual information between egui applications.

Latest version Documentation MIT

egui-theme defines a common interface for serializing and storing egui's style and font data for use between applications. The goal is to allow users of egui to easily create and share themes between relevant applications.

egui-theme is an intermediate format that is using serde_json to create this intermediate format.

How to use

The following example demonstrates how to create an EguiTheme and serialize it and deserialize it.

let theme = EguiTheme::new(
    Style::default(),
    FontDefinitions::default(),
);
let serialized_theme = ron::to_string(&theme).expect("this should serialize"):
let theme = ron::from_string::<EguiTheme>(serialized_theme).expect("this should deserialize");
let (style, font_definitions) = theme.extract();

After this point you can set the style and font definitions using egui::Context::set_style and egui::Context::set_fonts respectively.

Compatibility

Given development resources, only the latest version of egui is supported. This library will not be maintaining "migration scripts" to migrate previous themes of egui, but it old egui themes will still provide a best effort to load in. "Best Effort" means that deserializing an old egui theme will load as much compatible data as possible and not emit errors.

Dependencies

~4–11MB
~100K SLoC