summaryrefslogtreecommitdiff
path: root/src/config/theme/sheetview.rs
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2024-08-02 15:51:45 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2024-08-02 15:51:45 +0200
commitd1492a10cdaf714074d29ad3366ab9c169d95b75 (patch)
tree4192aa6825479f56332b3cd40d56913e48b95222 /src/config/theme/sheetview.rs
parentc920f258f6c9b0623a841b7c27561fa1d09cef72 (diff)
add bartheme and barstate to sheetview
Diffstat (limited to 'src/config/theme/sheetview.rs')
-rw-r--r--src/config/theme/sheetview.rs66
1 files changed, 0 insertions, 66 deletions
diff --git a/src/config/theme/sheetview.rs b/src/config/theme/sheetview.rs
deleted file mode 100644
index af0b585..0000000
--- a/src/config/theme/sheetview.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-use mlua::UserData;
-use ratatui::style::Color;
-
-use crate::{config::GlobalConfig, lua::evalsto::EvalTo, sheet::cell::CellRef};
-
-use super::style::Style;
-
-#[derive(Debug, Clone, Default)]
-pub struct SheetViewTheme {
- pub cursor: EvalTo<Style, CellRef>,
- pub selection: EvalTo<Style, CellRef>,
- pub cell: EvalTo<Style, CellRef>,
- pub background: EvalTo<Style, ()>,
-}
-
-impl SheetViewTheme {
- pub const fn new() -> Self {
- Self {
- cursor: EvalTo::Value(Style::new().fg(Color::Black).bg(Color::White)),
- selection: EvalTo::Value(Style::new().fg(Color::White).bg(Color::DarkGray)),
- cell: EvalTo::Value(Style::new().fg(Color::White).bg(Color::Black)),
- background: EvalTo::Value(Style::new().bg(Color::Black)),
- }
- }
-}
-
-macro_rules! cfg {
- () => {
- GlobalConfig::instance().theme.sheetview
- };
-}
-
-macro_rules! cfg_mut {
- () => {
- GlobalConfig::instance_mut().theme.sheetview
- };
-}
-
-impl UserData for SheetViewTheme {
- fn add_fields<'lua, F: mlua::prelude::LuaUserDataFields<'lua, Self>>(fields: &mut F) {
- fields.add_field_function_get("cursor", |_, _| Ok(cfg!().cursor.clone()));
-
- fields.add_field_function_set("cursor", |_, _, pair: EvalTo<Style, CellRef>| {
- cfg_mut!().cursor = pair;
- Ok(())
- });
-
- fields.add_field_function_get("selection", |_, _| Ok(cfg!().selection.clone()));
- fields.add_field_function_set("selection", |_, _, pair: EvalTo<Style, CellRef>| {
- cfg_mut!().selection = pair;
- Ok(())
- });
-
- fields.add_field_function_get("cell", |_, _| Ok(cfg!().cell.clone()));
- fields.add_field_function_set("cell", |_, _, cell: EvalTo<Style, CellRef>| {
- cfg_mut!().cell = cell;
- Ok(())
- });
-
- fields.add_field_function_get("background", |_, _| Ok(cfg!().background.clone()));
- fields.add_field_function_set("background", |_, _, background: EvalTo<Style, ()>| {
- cfg_mut!().background = background;
- Ok(())
- });
- }
-}