1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use bevy::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Component, Reflect, Default, Serialize, Deserialize)]
#[reflect(Component)]
pub struct Theme {
    /// hoverred interactive widget
    pub hovered: Widget,
    /// opened combo box
    pub open: Widget,
    /// non-interactive widget
    pub noninteractive: Widget,
    /// inactive widget
    pub inactive: Widget,
    /// active widget
    pub active: Widget,
    pub window_corner_radius: f32,
    pub window_shadow: Shadow,
}

#[derive(Reflect, Serialize, Deserialize, Clone)]
pub struct Stroke {
    pub color: Color,
    pub size: f32,
}

impl Default for Stroke {
    fn default() -> Self {
        Self {
            color: Color::BLACK,
            size: 1.0,
        }
    }
}

#[derive(Reflect, Default, Serialize, Deserialize)]
pub struct Shadow {
    pub color: Color,
    pub extrusion: f32,
}

#[derive(Reflect, Default, Serialize, Deserialize)]
pub struct Widget {
    pub background: Color,
    pub border: Stroke,
    pub stroke: Stroke,
}