summaryrefslogtreecommitdiff
path: root/src/config/theme/mod.rs
blob: 0f5f94ab263d4af9276b0781aad9576ddadf33ae (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, view::SheetViewTheme};

use super::DUMMY_CONFIG;

mod bar;
pub mod editor;
pub mod view;
pub mod style;

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

impl Theme {
    pub const fn new() -> Self {
        Self {
            view: 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("view", |_, _| Ok(DUMMY_CONFIG.theme.view));

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