mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: theme support for the spotter border and title (#2002)
This commit is contained in:
parent
783e95b1f2
commit
5bd71bf225
4 changed files with 157 additions and 128 deletions
|
|
@ -15,6 +15,7 @@ light = ""
|
||||||
|
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Manager {{{
|
# : Manager {{{
|
||||||
|
|
||||||
[manager]
|
[manager]
|
||||||
|
|
@ -93,7 +94,59 @@ perm_exec = { fg = "cyan" }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Pick {{{
|
# : Which {{{
|
||||||
|
|
||||||
|
[which]
|
||||||
|
cols = 3
|
||||||
|
mask = { bg = "black" }
|
||||||
|
cand = { fg = "lightcyan" }
|
||||||
|
rest = { fg = "darkgray" }
|
||||||
|
desc = { fg = "lightmagenta" }
|
||||||
|
separator = " "
|
||||||
|
separator_style = { fg = "darkgray" }
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Confirmation {{{
|
||||||
|
|
||||||
|
[confirm]
|
||||||
|
border = { fg = "blue" }
|
||||||
|
title = { fg = "blue" }
|
||||||
|
content = {}
|
||||||
|
list = {}
|
||||||
|
btn_yes = { reversed = true }
|
||||||
|
btn_no = {}
|
||||||
|
btn_labels = [ " [Y]es ", " (N)o " ]
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Spotter {{{
|
||||||
|
|
||||||
|
[spot]
|
||||||
|
border = { fg = "blue" }
|
||||||
|
title = { fg = "blue" }
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Notification {{{
|
||||||
|
|
||||||
|
[notify]
|
||||||
|
title_info = { fg = "green" }
|
||||||
|
title_warn = { fg = "yellow" }
|
||||||
|
title_error = { fg = "red" }
|
||||||
|
|
||||||
|
# Icons
|
||||||
|
icon_info = ""
|
||||||
|
icon_warn = ""
|
||||||
|
icon_error = ""
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Picker {{{
|
||||||
|
|
||||||
[pick]
|
[pick]
|
||||||
border = { fg = "blue" }
|
border = { fg = "blue" }
|
||||||
|
|
@ -114,20 +167,6 @@ selected = { reversed = true }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Confirm {{{
|
|
||||||
|
|
||||||
[confirm]
|
|
||||||
border = { fg = "blue" }
|
|
||||||
title = { fg = "blue" }
|
|
||||||
content = {}
|
|
||||||
list = {}
|
|
||||||
btn_yes = { reversed = true }
|
|
||||||
btn_no = {}
|
|
||||||
btn_labels = [ " [Y]es ", " (N)o " ]
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Completion {{{
|
# : Completion {{{
|
||||||
|
|
||||||
[completion]
|
[completion]
|
||||||
|
|
@ -143,7 +182,7 @@ icon_command = ""
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Tasks {{{
|
# : Task manager {{{
|
||||||
|
|
||||||
[tasks]
|
[tasks]
|
||||||
border = { fg = "blue" }
|
border = { fg = "blue" }
|
||||||
|
|
@ -153,21 +192,7 @@ hovered = { fg = "magenta", underline = true }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Which {{{
|
# : Help menu {{{
|
||||||
|
|
||||||
[which]
|
|
||||||
cols = 3
|
|
||||||
mask = { bg = "black" }
|
|
||||||
cand = { fg = "lightcyan" }
|
|
||||||
rest = { fg = "darkgray" }
|
|
||||||
desc = { fg = "lightmagenta" }
|
|
||||||
separator = " "
|
|
||||||
separator_style = { fg = "darkgray" }
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Help {{{
|
|
||||||
|
|
||||||
[help]
|
[help]
|
||||||
on = { fg = "cyan" }
|
on = { fg = "cyan" }
|
||||||
|
|
@ -179,21 +204,6 @@ footer = { fg = "black", bg = "white" }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Notify {{{
|
|
||||||
|
|
||||||
[notify]
|
|
||||||
title_info = { fg = "green" }
|
|
||||||
title_warn = { fg = "yellow" }
|
|
||||||
title_error = { fg = "red" }
|
|
||||||
|
|
||||||
# Icons
|
|
||||||
icon_info = ""
|
|
||||||
icon_warn = ""
|
|
||||||
icon_error = ""
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : File-specific styles {{{
|
# : File-specific styles {{{
|
||||||
|
|
||||||
[filetype]
|
[filetype]
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ light = ""
|
||||||
|
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Manager {{{
|
# : Manager {{{
|
||||||
|
|
||||||
[manager]
|
[manager]
|
||||||
|
|
@ -93,7 +94,59 @@ perm_exec = { fg = "cyan" }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Pick {{{
|
# : Which {{{
|
||||||
|
|
||||||
|
[which]
|
||||||
|
cols = 3
|
||||||
|
mask = { bg = "black" }
|
||||||
|
cand = { fg = "lightcyan" }
|
||||||
|
rest = { fg = "darkgray" }
|
||||||
|
desc = { fg = "lightmagenta" }
|
||||||
|
separator = " "
|
||||||
|
separator_style = { fg = "darkgray" }
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Confirmation {{{
|
||||||
|
|
||||||
|
[confirm]
|
||||||
|
border = { fg = "blue" }
|
||||||
|
title = { fg = "blue" }
|
||||||
|
content = {}
|
||||||
|
list = {}
|
||||||
|
btn_yes = { reversed = true }
|
||||||
|
btn_no = {}
|
||||||
|
btn_labels = [ " [Y]es ", " (N)o " ]
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Spotter {{{
|
||||||
|
|
||||||
|
[spot]
|
||||||
|
border = { fg = "blue" }
|
||||||
|
title = { fg = "blue" }
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Notification {{{
|
||||||
|
|
||||||
|
[notify]
|
||||||
|
title_info = { fg = "green" }
|
||||||
|
title_warn = { fg = "yellow" }
|
||||||
|
title_error = { fg = "red" }
|
||||||
|
|
||||||
|
# Icons
|
||||||
|
icon_info = ""
|
||||||
|
icon_warn = ""
|
||||||
|
icon_error = ""
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Picker {{{
|
||||||
|
|
||||||
[pick]
|
[pick]
|
||||||
border = { fg = "blue" }
|
border = { fg = "blue" }
|
||||||
|
|
@ -114,20 +167,6 @@ selected = { reversed = true }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Confirm {{{
|
|
||||||
|
|
||||||
[confirm]
|
|
||||||
border = { fg = "blue" }
|
|
||||||
title = { fg = "blue" }
|
|
||||||
content = {}
|
|
||||||
list = {}
|
|
||||||
btn_yes = { reversed = true }
|
|
||||||
btn_no = {}
|
|
||||||
btn_labels = [ " [Y]es ", " (N)o " ]
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Completion {{{
|
# : Completion {{{
|
||||||
|
|
||||||
[completion]
|
[completion]
|
||||||
|
|
@ -143,7 +182,7 @@ icon_command = ""
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Tasks {{{
|
# : Task manager {{{
|
||||||
|
|
||||||
[tasks]
|
[tasks]
|
||||||
border = { fg = "blue" }
|
border = { fg = "blue" }
|
||||||
|
|
@ -153,21 +192,7 @@ hovered = { fg = "magenta", underline = true }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Which {{{
|
# : Help menu {{{
|
||||||
|
|
||||||
[which]
|
|
||||||
cols = 3
|
|
||||||
mask = { bg = "black" }
|
|
||||||
cand = { fg = "lightcyan" }
|
|
||||||
rest = { fg = "darkgray" }
|
|
||||||
desc = { fg = "lightmagenta" }
|
|
||||||
separator = " "
|
|
||||||
separator_style = { fg = "darkgray" }
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Help {{{
|
|
||||||
|
|
||||||
[help]
|
[help]
|
||||||
on = { fg = "cyan" }
|
on = { fg = "cyan" }
|
||||||
|
|
@ -179,21 +204,6 @@ footer = { fg = "black", bg = "white" }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Notify {{{
|
|
||||||
|
|
||||||
[notify]
|
|
||||||
title_info = { fg = "green" }
|
|
||||||
title_warn = { fg = "yellow" }
|
|
||||||
title_error = { fg = "red" }
|
|
||||||
|
|
||||||
# Icons
|
|
||||||
icon_info = ""
|
|
||||||
icon_warn = ""
|
|
||||||
icon_error = ""
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : File-specific styles {{{
|
# : File-specific styles {{{
|
||||||
|
|
||||||
[filetype]
|
[filetype]
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,15 @@ pub struct Theme {
|
||||||
pub manager: Manager,
|
pub manager: Manager,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
status: Status,
|
status: Status,
|
||||||
pub input: Input,
|
pub which: Which,
|
||||||
pub confirm: Confirm,
|
pub confirm: Confirm,
|
||||||
|
pub spot: Spot,
|
||||||
|
pub notify: Notify,
|
||||||
pub pick: Pick,
|
pub pick: Pick,
|
||||||
|
pub input: Input,
|
||||||
pub completion: Completion,
|
pub completion: Completion,
|
||||||
pub tasks: Tasks,
|
pub tasks: Tasks,
|
||||||
pub which: Which,
|
|
||||||
pub help: Help,
|
pub help: Help,
|
||||||
pub notify: Notify,
|
|
||||||
|
|
||||||
// File-specific styles
|
// File-specific styles
|
||||||
#[serde(rename = "filetype", deserialize_with = "Filetype::deserialize", skip_serializing)]
|
#[serde(rename = "filetype", deserialize_with = "Filetype::deserialize", skip_serializing)]
|
||||||
|
|
@ -108,12 +109,17 @@ struct Status {
|
||||||
pub perm_exec: Style,
|
pub perm_exec: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize, Validate)]
|
||||||
pub struct Input {
|
pub struct Which {
|
||||||
pub border: Style,
|
#[validate(range(min = 1, max = 3, message = "Must be between 1 and 3"))]
|
||||||
pub title: Style,
|
pub cols: u8,
|
||||||
pub value: Style,
|
pub mask: Style,
|
||||||
pub selected: Style,
|
pub cand: Style,
|
||||||
|
pub rest: Style,
|
||||||
|
pub desc: Style,
|
||||||
|
|
||||||
|
pub separator: String,
|
||||||
|
pub separator_style: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
|
|
@ -127,6 +133,23 @@ pub struct Confirm {
|
||||||
pub btn_labels: [String; 2],
|
pub btn_labels: [String; 2],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Spot {
|
||||||
|
pub border: Style,
|
||||||
|
pub title: Style,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Notify {
|
||||||
|
pub title_info: Style,
|
||||||
|
pub title_warn: Style,
|
||||||
|
pub title_error: Style,
|
||||||
|
|
||||||
|
pub icon_info: String,
|
||||||
|
pub icon_warn: String,
|
||||||
|
pub icon_error: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Pick {
|
pub struct Pick {
|
||||||
pub border: Style,
|
pub border: Style,
|
||||||
|
|
@ -134,6 +157,14 @@ pub struct Pick {
|
||||||
pub inactive: Style,
|
pub inactive: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Input {
|
||||||
|
pub border: Style,
|
||||||
|
pub title: Style,
|
||||||
|
pub value: Style,
|
||||||
|
pub selected: Style,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Completion {
|
pub struct Completion {
|
||||||
pub border: Style,
|
pub border: Style,
|
||||||
|
|
@ -152,19 +183,6 @@ pub struct Tasks {
|
||||||
pub hovered: Style,
|
pub hovered: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Validate)]
|
|
||||||
pub struct Which {
|
|
||||||
#[validate(range(min = 1, max = 3, message = "Must be between 1 and 3"))]
|
|
||||||
pub cols: u8,
|
|
||||||
pub mask: Style,
|
|
||||||
pub cand: Style,
|
|
||||||
pub rest: Style,
|
|
||||||
pub desc: Style,
|
|
||||||
|
|
||||||
pub separator: String,
|
|
||||||
pub separator_style: Style,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Help {
|
pub struct Help {
|
||||||
pub on: Style,
|
pub on: Style,
|
||||||
|
|
@ -174,14 +192,3 @@ pub struct Help {
|
||||||
pub hovered: Style,
|
pub hovered: Style,
|
||||||
pub footer: Style,
|
pub footer: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Notify {
|
|
||||||
pub title_info: Style,
|
|
||||||
pub title_warn: Style,
|
|
||||||
pub title_error: Style,
|
|
||||||
|
|
||||||
pub icon_info: String,
|
|
||||||
pub icon_warn: String,
|
|
||||||
pub icon_error: String,
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use mlua::{AnyUserData, Function, Lua, Table};
|
use mlua::{AnyUserData, Function, Lua, Table};
|
||||||
use ratatui::style::Stylize;
|
use yazi_config::THEME;
|
||||||
use yazi_macro::emit;
|
use yazi_macro::emit;
|
||||||
use yazi_shared::{Layer, event::Cmd};
|
use yazi_shared::{Layer, event::Cmd};
|
||||||
|
|
||||||
|
|
@ -70,10 +70,12 @@ impl Utils {
|
||||||
area,
|
area,
|
||||||
position: ratatui::widgets::Borders::ALL,
|
position: ratatui::widgets::Borders::ALL,
|
||||||
type_: ratatui::widgets::BorderType::Rounded,
|
type_: ratatui::widgets::BorderType::Rounded,
|
||||||
style: ratatui::style::Style::default().blue(),
|
style: THEME.spot.border.into(),
|
||||||
titles: vec![(
|
titles: vec![(
|
||||||
ratatui::widgets::block::Position::Top,
|
ratatui::widgets::block::Position::Top,
|
||||||
ratatui::text::Line::raw(lock.url.name().to_string_lossy().into_owned()).centered(),
|
ratatui::text::Line::raw(lock.url.name().to_string_lossy().into_owned())
|
||||||
|
.centered()
|
||||||
|
.style(THEME.spot.title),
|
||||||
)],
|
)],
|
||||||
}),
|
}),
|
||||||
Renderable::Table(table),
|
Renderable::Table(table),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue