1use roost::{Assets, include_dir};
2use roost::drawable::Color;
3
4pub mod colors;
5pub use colors::*;
6pub mod fonts;
7pub use fonts::*;
8pub mod icons;
9pub use icons::*;
10pub mod brand;
11pub use brand::*;
12pub mod layout;
13pub use layout::*;
14
15pub struct Theme {
19 pub colors: ColorResources,
20 pub fonts: FontResources,
21 pub icons: IconResources,
22 pub brand: BrandResources,
23 pub layout: LayoutResources,
24}
25
26impl Theme {
34 pub fn default(ctx: &mut Assets) -> Self {
35 ctx.include_assets(include_dir!("./resources"));
36 Theme {
37 colors: ColorResources::default(),
38 fonts: FontResources::default(ctx),
39 icons: IconResources::default(ctx),
40 brand: BrandResources::default(ctx),
41 layout: LayoutResources::default(),
42 }
43 }
44
45 pub fn new(
47 ctx: &mut Assets,
48 colors: ColorResources,
49 fonts: FontResources,
50 icons: IconResources,
51 brand: BrandResources,
52 layout: LayoutResources,
53 ) -> Self {
54 ctx.include_assets(include_dir!("./resources"));
55 Theme { colors, fonts, icons, brand, layout }
56 }
57
58 pub fn from(ctx: &mut Assets, primary: Color) -> Self {
59 ctx.include_assets(include_dir!("./resources"));
60 Theme {
61 colors: ColorResources::from(primary),
62 fonts: FontResources::default(ctx),
63 icons: IconResources::default(ctx),
64 brand: BrandResources::default(ctx),
65 layout: LayoutResources::default(),
66 }
67 }
68
69 pub fn light(ctx: &mut Assets, primary: Color) -> Self {
70 ctx.include_assets(include_dir!("./resources"));
71 Theme {
72 colors: ColorResources::light(primary),
73 fonts: FontResources::default(ctx),
74 icons: IconResources::default(ctx),
75 brand: BrandResources::default(ctx),
76 layout: LayoutResources::default(),
77 }
78 }
79
80 pub fn dark(ctx: &mut Assets, primary: Color) -> Self {
81 ctx.include_assets(include_dir!("./resources"));
82 Theme {
83 colors: ColorResources::dark(primary),
84 fonts: FontResources::default(ctx),
85 icons: IconResources::default(ctx),
86 brand: BrandResources::default(ctx),
87 layout: LayoutResources::default(),
88 }
89 }
90}