This commit is contained in:
sxyazi 2023-10-12 09:29:28 +08:00
parent faa3281322
commit 3e0466f552
No known key found for this signature in database
6 changed files with 119 additions and 54 deletions

View file

@ -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(),
)
}

View file

@ -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
})

View file

@ -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" }
# : }}}

View file

@ -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,
}

View file

@ -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::*;

View file

@ -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,
// 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<Filetype>,
#[serde(deserialize_with = "Icon::deserialize", skip_serializing)]
pub icons: Vec<Icon>,
// Input
pub input: Input,
// Select
pub select: Select,
// Tasks
pub tasks: Tasks,
// Which
pub which: Which,
// Help
pub help: Help,
}
impl Default for Theme {