From 3e0466f5523790a4bf9f680a64351a6c993dd180 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Thu, 12 Oct 2023 09:29:28 +0800 Subject: [PATCH] .. --- app/src/input/input.rs | 4 +- app/src/tasks/layout.rs | 2 +- config/preset/theme.toml | 89 ++++++++++++++++++++++++++++++++++----- config/src/theme/list.rs | 15 ------- config/src/theme/mod.rs | 14 +++++- config/src/theme/theme.rs | 49 +++++++++++---------- 6 files changed, 119 insertions(+), 54 deletions(-) delete mode 100644 config/src/theme/list.rs diff --git a/app/src/input/input.rs b/app/src/input/input.rs index 8612523b..ea26ed3f 100644 --- a/app/src/input/input.rs +++ b/app/src/input/input.rs @@ -38,7 +38,7 @@ impl<'a> Widget for Input<'a> { line }), ) - .style(THEME.input.text.into()) + .style(THEME.input.value.into()) .render(area, buf); if let Some(Range { start, end }) = input.selected() { @@ -47,7 +47,7 @@ impl<'a> Widget for Input<'a> { buf.set_style( Rect { x, y, width: (end - start).min(win.width - x), height: 1.min(win.height - y) }, - THEME.input.visual.into(), + THEME.input.selected.into(), ) } diff --git a/app/src/tasks/layout.rs b/app/src/tasks/layout.rs index 09d62c2d..994855c2 100644 --- a/app/src/tasks/layout.rs +++ b/app/src/tasks/layout.rs @@ -60,7 +60,7 @@ impl<'a> Widget for Layout<'a> { .map(|(i, v)| { let mut item = ListItem::new(v.name.clone()); if i == tasks.cursor { - item = item.style(THEME.tasks.items.into()); + item = item.style(THEME.tasks.hovered.into()); } item }) diff --git a/config/preset/theme.toml b/config/preset/theme.toml index 1934524b..3375e8a9 100644 --- a/config/preset/theme.toml +++ b/config/preset/theme.toml @@ -1,8 +1,6 @@ -[tabs] -active = { fg = "#1E2031", bg = "#80AEFA" } -inactive = { fg = "#C8D3F8", bg = "#484D66" } -header = { fg = "#00FFFF" } -max_width = 1 +# vim:fileencoding=utf-8:foldmethod=marker + +# : Status {{{ [status] plain = { fg = "#FFFFFF" } @@ -26,6 +24,17 @@ permissions_w = { fg = "#FA7F94" } permissions_x = { fg = "#7AD9E5" } permissions_s = { fg = "#6D738F" } +# : }}} + + +# : Manager {{{ + +[tabs] +active = { fg = "#1E2031", bg = "#80AEFA" } +inactive = { fg = "#C8D3F8", bg = "#484D66" } +header = { fg = "#00FFFF" } +max_width = 1 + [files] hovered = { fg = "#1E2031", bg = "#80AEFA" } @@ -34,16 +43,17 @@ selected = { fg = "#97DC8D", bg = "#97DC8D" } copied = { fg = "#F3D398", bg = "#F3D398" } cut = { fg = "#FF84A9", bg = "#FF84A9" } +[find] +# arrow = { fg = "LightYellow", italic = true } + [preview] hovered = { underline = true } syntect_theme = "~/.config/bat/themes/Catppuccin-macchiato.tmTheme" -[help] -key = { fg = "#E5E510" } -exec = { fg = "#11A8CD" } -desc = { fg = "#E5E5E5" } -curr = { bg = "#666666", bold = true } -btm = { fg = "#666666", bg = "#E5E5E5" } +# : }}} + + +# : File-specific styles {{{ [filetype] @@ -163,3 +173,60 @@ rules = [ # Default "*" = "" "*/" = "" + +# : }}} + + +# : Input {{{ + +[input] +border = { fg = "blue" } +title = { fg = "white" } +value = { fg = "white" } +selected = { fg = "darkGray" } + +# : }}} + + +# : Select {{{ + +[select] +border = { fg = "blue" } +active = { fg = "magenta" } +inactive = { fg = "white" } + +# : }}} + + +# : Tasks {{{ + +[tasks] +border = { fg = "blue" } +title = { fg = "white" } +hovered = { underline = true } + +# : }}} + + +# : Which {{{ + +[which] +# block = { bg = "Black" } +# key = { fg = "LightCyan" } +# extend = { fg = "DarkGray" } +# desc = { fg = "Magenta" } +# separator = { separator = " -> ", color = "DarkGray" } + +# : }}} + + +# : Help {{{ + +[help] +# key = { fg = "#E5E510" } +# exec = { fg = "#11A8CD" } +# desc = { fg = "#E5E5E5" } +# curr = { bg = "#666666", bold = true } +# btm = { fg = "#666666", bg = "#E5E5E5" } + +# : }}} diff --git a/config/src/theme/list.rs b/config/src/theme/list.rs deleted file mode 100644 index 5ce1556b..00000000 --- a/config/src/theme/list.rs +++ /dev/null @@ -1,15 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use super::Style; - -#[derive(Deserialize, Serialize)] -pub struct Files { - pub hovered: Style, -} - -#[derive(Deserialize, Serialize)] -pub struct Marker { - pub selected: Style, - pub copied: Style, - pub cut: Style, -} diff --git a/config/src/theme/mod.rs b/config/src/theme/mod.rs index ee9b13fb..2e2a6967 100644 --- a/config/src/theme/mod.rs +++ b/config/src/theme/mod.rs @@ -1,15 +1,25 @@ mod color; mod filetype; +mod help; mod icon; -mod list; +mod input; +mod manager; +mod select; mod status; mod style; +mod tasks; mod theme; +mod which; pub use color::*; pub use filetype::*; +pub use help::*; pub use icon::*; -pub use list::*; +pub use input::*; +pub use manager::*; +pub use select::*; pub use status::*; pub use style::*; +pub use tasks::*; pub use theme::*; +pub use which::*; diff --git a/config/src/theme/theme.rs b/config/src/theme/theme.rs index e8626d82..ce912ff6 100644 --- a/config/src/theme/theme.rs +++ b/config/src/theme/theme.rs @@ -1,38 +1,41 @@ -use std::path::PathBuf; - use serde::{Deserialize, Serialize}; use shared::expand_path; use validator::Validate; -use super::{Files, Filetype, Icon, Marker, Status, Style}; +use super::{Files, Filetype, Help, Icon, Input, Marker, Preview, Select, Status, Tabs, Tasks, Which}; use crate::{validation::check_validation, MERGED_THEME}; -#[derive(Deserialize, Serialize, Validate)] -pub struct Tabs { - pub active: Style, - pub inactive: Style, - pub header: Style, - #[validate(range(min = 1, message = "Must be greater than 0"))] - pub max_width: u8, -} - -#[derive(Deserialize, Serialize)] -pub struct Preview { - pub hovered: Style, - pub syntect_theme: PathBuf, -} - #[derive(Deserialize, Serialize)] pub struct Theme { - pub tabs: Tabs, - pub status: Status, - pub files: Files, - pub marker: Marker, - pub preview: Preview, + // Status + pub status: Status, + + // Manager + pub tabs: Tabs, + pub files: Files, + pub marker: Marker, + pub preview: Preview, + + // File-specific styles #[serde(rename = "filetype", deserialize_with = "Filetype::deserialize", skip_serializing)] pub filetypes: Vec, #[serde(deserialize_with = "Icon::deserialize", skip_serializing)] pub icons: Vec, + + // Input + pub input: Input, + + // Select + pub select: Select, + + // Tasks + pub tasks: Tasks, + + // Which + pub which: Which, + + // Help + pub help: Help, } impl Default for Theme {