summaryrefslogtreecommitdiff
path: root/src/config/theme/mod.rs
blob: b714e86d39a889e3743a62d4f877c95157826782 (plain)
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
use mlua::UserData;

use self::{editor::EditorTheme, sheetview::SheetViewTheme};

use super::DUMMY_CONFIG;

mod bar;
pub mod editor;
pub mod sheetview;
pub mod style;

#[derive(Clone, Debug, Default)]
pub struct Theme {
    pub sheetview: SheetViewTheme,
    pub editor: EditorTheme,
}

impl Theme {
    pub const fn new() -> Self {
        Self {
            sheetview: SheetViewTheme::new(),
            editor: EditorTheme::new(),
        }
    }
}

impl UserData for Theme {
    fn add_fields<'lua, F: mlua::prelude::LuaUserDataFields<'lua, Self>>(fields: &mut F) {
        fields.add_field_function_get("sheetview", |_, _| Ok(DUMMY_CONFIG.theme.sheetview));

        fields.add_field_function_get("editor", |_, _| Ok(DUMMY_CONFIG.theme.editor))
    }
}