mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: some colors not readable in light mode (#264)
This commit is contained in:
parent
4b71668742
commit
29e313640b
16 changed files with 209 additions and 256 deletions
|
|
@ -1,10 +1,40 @@
|
||||||
# vim:fileencoding=utf-8:foldmethod=marker
|
# vim:fileencoding=utf-8:foldmethod=marker
|
||||||
|
|
||||||
|
# : Manager {{{
|
||||||
|
|
||||||
|
[manager]
|
||||||
|
cwd = { fg = "cyan" }
|
||||||
|
|
||||||
|
# Hovered
|
||||||
|
hovered = { fg = "#000000", bg = "blue" }
|
||||||
|
preview_hovered = { underline = true }
|
||||||
|
|
||||||
|
# Find
|
||||||
|
find_keyword = { fg = "yellow", italic = true }
|
||||||
|
find_position = { fg = "magenta", bg = "reset", italic = true }
|
||||||
|
|
||||||
|
# Marker
|
||||||
|
marker_selected = { fg = "lightgreen", bg = "lightgreen" }
|
||||||
|
marker_copied = { fg = "lightyellow", bg = "lightyellow" }
|
||||||
|
marker_cut = { fg = "lightred", bg = "lightred" }
|
||||||
|
|
||||||
|
# Tab
|
||||||
|
tab_active = { fg = "black", bg = "blue" }
|
||||||
|
tab_inactive = { bg = "darkgray" }
|
||||||
|
tab_width = 1
|
||||||
|
|
||||||
|
# Highlighting
|
||||||
|
syntect_theme = ""
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Status {{{
|
# : Status {{{
|
||||||
|
|
||||||
[status]
|
[status]
|
||||||
fancy = { bg = "darkgray" }
|
separator_open = ""
|
||||||
separator = { opening = "", closing = "" }
|
separator_close = ""
|
||||||
|
separator_style = { fg = "darkgray", bg = "darkgray" }
|
||||||
|
|
||||||
# Mode
|
# Mode
|
||||||
mode_normal = { fg = "black", bg = "blue", bold = true }
|
mode_normal = { fg = "black", bg = "blue", bold = true }
|
||||||
|
|
@ -26,24 +56,58 @@ permissions_s = { fg = "darkgray" }
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Manager {{{
|
# : Input {{{
|
||||||
|
|
||||||
[tabs]
|
[input]
|
||||||
active = { fg = "black", bg = "blue" }
|
border = { fg = "blue" }
|
||||||
inactive = { bg = "darkgray" }
|
title = {}
|
||||||
max_width = 1
|
value = {}
|
||||||
|
selected = { fg = "black", bg = "white" }
|
||||||
|
|
||||||
[files]
|
# : }}}
|
||||||
hovered = { fg = "#000000", bg = "blue" }
|
|
||||||
|
|
||||||
[marker]
|
|
||||||
selected = { fg = "lightgreen", bg = "lightgreen" }
|
|
||||||
copied = { fg = "lightyellow", bg = "lightyellow" }
|
|
||||||
cut = { fg = "lightred", bg = "lightred" }
|
|
||||||
|
|
||||||
[preview]
|
# : Select {{{
|
||||||
hovered = { underline = true }
|
|
||||||
syntect_theme = "~/.config/bat/themes/Catppuccin-macchiato.tmTheme"
|
[select]
|
||||||
|
border = { fg = "blue" }
|
||||||
|
active = { fg = "magenta" }
|
||||||
|
inactive = {}
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Tasks {{{
|
||||||
|
|
||||||
|
[tasks]
|
||||||
|
border = { fg = "blue" }
|
||||||
|
title = {}
|
||||||
|
hovered = { underline = true }
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Which {{{
|
||||||
|
|
||||||
|
[which]
|
||||||
|
mask = { bg = "black" }
|
||||||
|
cand = { fg = "lightcyan" }
|
||||||
|
rest = { fg = "darkgray" }
|
||||||
|
desc = { fg = "magenta" }
|
||||||
|
separator = " "
|
||||||
|
separator_style = { fg = "darkgray" }
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Help {{{
|
||||||
|
|
||||||
|
[help]
|
||||||
|
on = { fg = "magenta" }
|
||||||
|
exec = { fg = "cyan" }
|
||||||
|
desc = { fg = "gray" }
|
||||||
|
hovered = { bg = "darkgray", bold = true }
|
||||||
|
footer = { fg = "black", bg = "white" }
|
||||||
|
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
@ -169,59 +233,3 @@ rules = [
|
||||||
"*/" = ""
|
"*/" = ""
|
||||||
|
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
# : Input {{{
|
|
||||||
|
|
||||||
[input]
|
|
||||||
border = { fg = "blue" }
|
|
||||||
title = { fg = "white" }
|
|
||||||
value = { fg = "white" }
|
|
||||||
selected = { bg = "black" }
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Select {{{
|
|
||||||
|
|
||||||
[select]
|
|
||||||
border = { fg = "blue" }
|
|
||||||
active = { fg = "magenta" }
|
|
||||||
inactive = { fg = "white" }
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Tasks {{{
|
|
||||||
|
|
||||||
[tasks]
|
|
||||||
border = { fg = "blue" }
|
|
||||||
title = { fg = "white" }
|
|
||||||
hovered = { underline = true }
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Which {{{
|
|
||||||
|
|
||||||
[which]
|
|
||||||
mask = { bg = "black" }
|
|
||||||
cand = { fg = "lightcyan" }
|
|
||||||
rest = { fg = "darkgray" }
|
|
||||||
desc = { fg = "magenta" }
|
|
||||||
separator = " "
|
|
||||||
separator_style = { fg = "darkgray" }
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
||||||
|
|
||||||
# : Help {{{
|
|
||||||
|
|
||||||
[help]
|
|
||||||
on = { fg = "magenta" }
|
|
||||||
exec = { fg = "cyan" }
|
|
||||||
desc = { fg = "gray" }
|
|
||||||
hovered = { bg = "darkgray", bold = true }
|
|
||||||
footer = { fg = "black", bg = "white" }
|
|
||||||
|
|
||||||
# : }}}
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ use std::path::Path;
|
||||||
|
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
|
|
||||||
use super::Style;
|
use super::{Color, Style, StyleShadow};
|
||||||
use crate::{theme::{Color, StyleShadow}, Pattern};
|
use crate::Pattern;
|
||||||
|
|
||||||
pub struct Filetype {
|
pub struct Filetype {
|
||||||
pub name: Option<Pattern>,
|
pub name: Option<Pattern>,
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use super::Style;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Help {
|
|
||||||
pub on: Style,
|
|
||||||
pub exec: Style,
|
|
||||||
pub desc: Style,
|
|
||||||
|
|
||||||
pub hovered: Style,
|
|
||||||
pub footer: Style,
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use super::Style;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Input {
|
|
||||||
pub border: Style,
|
|
||||||
pub title: Style,
|
|
||||||
pub value: Style,
|
|
||||||
pub selected: Style,
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use validator::Validate;
|
|
||||||
|
|
||||||
use super::Style;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Validate)]
|
|
||||||
pub struct Tabs {
|
|
||||||
pub active: Style,
|
|
||||||
pub inactive: Style,
|
|
||||||
#[validate(range(min = 1, message = "Must be greater than 0"))]
|
|
||||||
pub max_width: u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Files {
|
|
||||||
pub hovered: Style,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Marker {
|
|
||||||
pub selected: Style,
|
|
||||||
pub copied: Style,
|
|
||||||
pub cut: Style,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Preview {
|
|
||||||
pub hovered: Style,
|
|
||||||
pub syntect_theme: PathBuf,
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +1,11 @@
|
||||||
mod color;
|
mod color;
|
||||||
mod filetype;
|
mod filetype;
|
||||||
mod help;
|
|
||||||
mod icon;
|
mod icon;
|
||||||
mod input;
|
|
||||||
mod manager;
|
|
||||||
mod select;
|
|
||||||
mod status;
|
|
||||||
mod style;
|
mod style;
|
||||||
mod tasks;
|
|
||||||
mod theme;
|
mod theme;
|
||||||
mod which;
|
|
||||||
|
|
||||||
pub use color::*;
|
pub use color::*;
|
||||||
pub use filetype::*;
|
pub use filetype::*;
|
||||||
pub use help::*;
|
|
||||||
pub use icon::*;
|
pub use icon::*;
|
||||||
pub use input::*;
|
|
||||||
pub use manager::*;
|
|
||||||
pub use select::*;
|
|
||||||
pub use status::*;
|
|
||||||
pub use style::*;
|
pub use style::*;
|
||||||
pub use tasks::*;
|
|
||||||
pub use theme::*;
|
pub use theme::*;
|
||||||
pub use which::*;
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use super::Style;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Select {
|
|
||||||
pub border: Style,
|
|
||||||
pub active: Style,
|
|
||||||
pub inactive: Style,
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use super::Style;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Status {
|
|
||||||
pub fancy: Style,
|
|
||||||
pub separator: StatusSeparator,
|
|
||||||
|
|
||||||
// Mode
|
|
||||||
pub mode_normal: Style,
|
|
||||||
pub mode_select: Style,
|
|
||||||
pub mode_unset: Style,
|
|
||||||
|
|
||||||
// Progress
|
|
||||||
pub progress_label: Style,
|
|
||||||
pub progress_normal: Style,
|
|
||||||
pub progress_error: Style,
|
|
||||||
|
|
||||||
// Permissions
|
|
||||||
pub permissions_t: Style,
|
|
||||||
pub permissions_r: Style,
|
|
||||||
pub permissions_w: Style,
|
|
||||||
pub permissions_x: Style,
|
|
||||||
pub permissions_s: Style,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct StatusSeparator {
|
|
||||||
pub opening: String,
|
|
||||||
pub closing: String,
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use super::Style;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Tasks {
|
|
||||||
pub border: Style,
|
|
||||||
pub title: Style,
|
|
||||||
pub hovered: Style,
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +1,130 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use shared::expand_path;
|
use shared::expand_path;
|
||||||
use validator::Validate;
|
use validator::Validate;
|
||||||
|
|
||||||
use super::{Files, Filetype, Help, Icon, Input, Marker, Preview, Select, Status, Tabs, Tasks, Which};
|
use super::{Filetype, Icon, Style};
|
||||||
use crate::{validation::check_validation, MERGED_THEME};
|
use crate::{validation::check_validation, MERGED_THEME};
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize, Validate)]
|
||||||
|
pub struct Manager {
|
||||||
|
cwd: Style,
|
||||||
|
|
||||||
|
// Hovered
|
||||||
|
hovered: Style,
|
||||||
|
preview_hovered: Style,
|
||||||
|
|
||||||
|
// Find
|
||||||
|
find_keyword: Style,
|
||||||
|
find_position: Style,
|
||||||
|
|
||||||
|
// Marker
|
||||||
|
marker_selected: Style,
|
||||||
|
marker_copied: Style,
|
||||||
|
marker_cut: Style,
|
||||||
|
|
||||||
|
// Tab
|
||||||
|
tab_active: Style,
|
||||||
|
tab_inactive: Style,
|
||||||
|
#[validate(range(min = 1, message = "Must be greater than 0"))]
|
||||||
|
tab_width: u8,
|
||||||
|
|
||||||
|
// Highlighting
|
||||||
|
pub syntect_theme: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
struct Status {
|
||||||
|
pub separator_open: String,
|
||||||
|
pub separator_close: String,
|
||||||
|
pub separator_style: Style,
|
||||||
|
|
||||||
|
// Mode
|
||||||
|
pub mode_normal: Style,
|
||||||
|
pub mode_select: Style,
|
||||||
|
pub mode_unset: Style,
|
||||||
|
|
||||||
|
// Progress
|
||||||
|
pub progress_label: Style,
|
||||||
|
pub progress_normal: Style,
|
||||||
|
pub progress_error: Style,
|
||||||
|
|
||||||
|
// Permissions
|
||||||
|
pub permissions_t: Style,
|
||||||
|
pub permissions_r: Style,
|
||||||
|
pub permissions_w: Style,
|
||||||
|
pub permissions_x: Style,
|
||||||
|
pub permissions_s: Style,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Input {
|
||||||
|
pub border: Style,
|
||||||
|
pub title: Style,
|
||||||
|
pub value: Style,
|
||||||
|
pub selected: Style,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Select {
|
||||||
|
pub border: Style,
|
||||||
|
pub active: Style,
|
||||||
|
pub inactive: Style,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Tasks {
|
||||||
|
pub border: Style,
|
||||||
|
pub title: Style,
|
||||||
|
pub hovered: Style,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Which {
|
||||||
|
pub mask: Style,
|
||||||
|
pub cand: Style,
|
||||||
|
pub rest: Style,
|
||||||
|
pub desc: Style,
|
||||||
|
|
||||||
|
pub separator: String,
|
||||||
|
pub separator_style: Style,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Help {
|
||||||
|
pub on: Style,
|
||||||
|
pub exec: Style,
|
||||||
|
pub desc: Style,
|
||||||
|
|
||||||
|
pub hovered: Style,
|
||||||
|
pub footer: Style,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Theme {
|
pub struct Theme {
|
||||||
// Status
|
pub manager: Manager,
|
||||||
pub status: Status,
|
status: Status,
|
||||||
|
pub input: Input,
|
||||||
// Manager
|
pub select: Select,
|
||||||
pub tabs: Tabs,
|
pub tasks: Tasks,
|
||||||
pub files: Files,
|
pub which: Which,
|
||||||
pub marker: Marker,
|
pub help: Help,
|
||||||
pub preview: Preview,
|
|
||||||
|
|
||||||
// File-specific styles
|
// File-specific styles
|
||||||
#[serde(rename = "filetype", deserialize_with = "Filetype::deserialize", skip_serializing)]
|
#[serde(rename = "filetype", deserialize_with = "Filetype::deserialize", skip_serializing)]
|
||||||
pub filetypes: Vec<Filetype>,
|
pub filetypes: Vec<Filetype>,
|
||||||
#[serde(deserialize_with = "Icon::deserialize", skip_serializing)]
|
#[serde(deserialize_with = "Icon::deserialize", skip_serializing)]
|
||||||
pub icons: Vec<Icon>,
|
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 {
|
impl Default for Theme {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let mut theme: Self = toml::from_str(&MERGED_THEME).unwrap();
|
let mut theme: Self = toml::from_str(&MERGED_THEME).unwrap();
|
||||||
|
|
||||||
check_validation(theme.tabs.validate());
|
check_validation(theme.manager.validate());
|
||||||
|
|
||||||
theme.preview.syntect_theme = expand_path(&theme.preview.syntect_theme);
|
theme.manager.syntect_theme = expand_path(&theme.manager.syntect_theme);
|
||||||
|
|
||||||
theme
|
theme
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use super::Style;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Which {
|
|
||||||
pub mask: Style,
|
|
||||||
pub cand: Style,
|
|
||||||
pub rest: Style,
|
|
||||||
pub desc: Style,
|
|
||||||
|
|
||||||
pub separator: String,
|
|
||||||
pub separator_style: Style,
|
|
||||||
}
|
|
||||||
|
|
@ -14,7 +14,7 @@ pub fn highlighter() -> (&'static SyntaxSet, &'static Theme) {
|
||||||
|
|
||||||
let theme = SYNTECT_THEME.get_or_init(|| {
|
let theme = SYNTECT_THEME.get_or_init(|| {
|
||||||
let from_file = || -> Result<Theme> {
|
let from_file = || -> Result<Theme> {
|
||||||
let file = File::open(&THEME.preview.syntect_theme)?;
|
let file = File::open(&THEME.manager.syntect_theme)?;
|
||||||
Ok(ThemeSet::load_from_reader(&mut BufReader::new(file))?)
|
Ok(ThemeSet::load_from_reader(&mut BufReader::new(file))?)
|
||||||
};
|
};
|
||||||
from_file().unwrap_or_else(|_| ThemeSet::load_defaults().themes["base16-ocean.dark"].clone())
|
from_file().unwrap_or_else(|_| ThemeSet::load_defaults().themes["base16-ocean.dark"].clone())
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ function Folder:markers(area, markers)
|
||||||
)
|
)
|
||||||
|
|
||||||
if last[3] == 1 then
|
if last[3] == 1 then
|
||||||
p = p:style(THEME.marker.copied)
|
p = p:style(THEME.manager.marker_copied)
|
||||||
elseif last[3] == 2 then
|
elseif last[3] == 2 then
|
||||||
p = p:style(THEME.marker.cut)
|
p = p:style(THEME.manager.marker_cut)
|
||||||
elseif last[3] == 3 then
|
elseif last[3] == 3 then
|
||||||
p = p:style(THEME.marker.selected)
|
p = p:style(THEME.manager.marker_selected)
|
||||||
end
|
end
|
||||||
elements[#elements + 1] = p
|
elements[#elements + 1] = p
|
||||||
end
|
end
|
||||||
|
|
@ -79,7 +79,8 @@ function Folder:highlighted_name(file)
|
||||||
|
|
||||||
local found = file:found()
|
local found = file:found()
|
||||||
if found ~= nil then
|
if found ~= nil then
|
||||||
spans[#spans + 1] = ui.Span(string.format(" [%d/%d]", found[1] + 1, found[2])):fg("#ffff32"):italic()
|
spans[#spans + 1] = ui.Span(" ")
|
||||||
|
spans[#spans + 1] = ui.Span(string.format("[%d/%d]", found[1] + 1, found[2])):style(THEME.manager.find_position)
|
||||||
end
|
end
|
||||||
return spans
|
return spans
|
||||||
end
|
end
|
||||||
|
|
@ -94,7 +95,7 @@ function Folder:parent(area)
|
||||||
for _, f in ipairs(folder.window) do
|
for _, f in ipairs(folder.window) do
|
||||||
local item = ui.ListItem(" " .. f:icon() .. " " .. f.name .. " ")
|
local item = ui.ListItem(" " .. f:icon() .. " " .. f.name .. " ")
|
||||||
if f:is_hovered() then
|
if f:is_hovered() then
|
||||||
item = item:style(THEME.files.hovered)
|
item = item:style(THEME.manager.hovered)
|
||||||
else
|
else
|
||||||
item = item:style(f:style())
|
item = item:style(f:style())
|
||||||
end
|
end
|
||||||
|
|
@ -114,7 +115,7 @@ function Folder:current(area)
|
||||||
-- Highlight hovered file
|
-- Highlight hovered file
|
||||||
local item = ui.ListItem(ui.Line { ui.Span(" " .. f:icon() .. " "), table.unpack(name) })
|
local item = ui.ListItem(ui.Line { ui.Span(" " .. f:icon() .. " "), table.unpack(name) })
|
||||||
if f:is_hovered() then
|
if f:is_hovered() then
|
||||||
item = item:style(THEME.files.hovered)
|
item = item:style(THEME.manager.hovered)
|
||||||
else
|
else
|
||||||
item = item:style(f:style())
|
item = item:style(f:style())
|
||||||
end
|
end
|
||||||
|
|
@ -142,7 +143,7 @@ function Folder:preview(area)
|
||||||
for _, f in ipairs(folder.window) do
|
for _, f in ipairs(folder.window) do
|
||||||
local item = ui.ListItem(" " .. f:icon() .. " " .. f.name .. " ")
|
local item = ui.ListItem(" " .. f:icon() .. " " .. f.name .. " ")
|
||||||
if f:is_hovered() then
|
if f:is_hovered() then
|
||||||
item = item:style(THEME.preview.hovered)
|
item = item:style(THEME.manager.preview_hovered)
|
||||||
else
|
else
|
||||||
item = item:style(f:style())
|
item = item:style(f:style())
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,20 @@ function Header:cwd()
|
||||||
else
|
else
|
||||||
span = ui.Span(string.format("%s (search: %s)", utils.readable_path(tostring(cwd)), cwd.frag))
|
span = ui.Span(string.format("%s (search: %s)", utils.readable_path(tostring(cwd)), cwd.frag))
|
||||||
end
|
end
|
||||||
return span:fg("cyan")
|
return span:style(THEME.manager.cwd)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Header:tabs()
|
function Header:tabs()
|
||||||
local spans = {}
|
local spans = {}
|
||||||
for i = 1, #cx.tabs do
|
for i = 1, #cx.tabs do
|
||||||
local text = i
|
local text = i
|
||||||
if THEME.tabs.max_width > 2 then
|
if THEME.manager.tab_width > 2 then
|
||||||
text = utils.truncate(text .. " " .. cx.tabs[i]:name(), THEME.tabs.max_width)
|
text = utils.truncate(text .. " " .. cx.tabs[i]:name(), THEME.manager.tab_width)
|
||||||
end
|
end
|
||||||
if i == cx.tabs.idx + 1 then
|
if i == cx.tabs.idx + 1 then
|
||||||
spans[#spans + 1] = ui.Span(" " .. text .. " "):style(THEME.tabs.active)
|
spans[#spans + 1] = ui.Span(" " .. text .. " "):style(THEME.manager.tab_active)
|
||||||
else
|
else
|
||||||
spans[#spans + 1] = ui.Span(" " .. text .. " "):style(THEME.tabs.inactive)
|
spans[#spans + 1] = ui.Span(" " .. text .. " "):style(THEME.manager.tab_inactive)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ui.Line(spans)
|
return ui.Line(spans)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ function Status:mode()
|
||||||
|
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line {
|
return ui.Line {
|
||||||
ui.Span(THEME.status.separator.opening):fg(style.bg),
|
ui.Span(THEME.status.separator_open):fg(style.bg),
|
||||||
ui.Span(" " .. mode .. " "):style(style),
|
ui.Span(" " .. mode .. " "):style(style),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -31,8 +31,8 @@ function Status:size()
|
||||||
|
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line {
|
return ui.Line {
|
||||||
ui.Span(" " .. utils.readable_size(h.length) .. " "):fg(style.bg):bg(THEME.status.fancy.bg),
|
ui.Span(" " .. utils.readable_size(h.length) .. " "):fg(style.bg):bg(THEME.status.separator_style.bg),
|
||||||
ui.Span(THEME.status.separator.closing):fg(THEME.status.fancy.bg),
|
ui.Span(THEME.status.separator_close):fg(THEME.status.separator_style.fg),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -85,8 +85,8 @@ function Status:percentage()
|
||||||
|
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line {
|
return ui.Line {
|
||||||
ui.Span(" " .. THEME.status.separator.opening):fg(THEME.status.fancy.bg),
|
ui.Span(" " .. THEME.status.separator_open):fg(THEME.status.separator_style.fg),
|
||||||
ui.Span(percent):fg(style.bg):bg(THEME.status.fancy.bg),
|
ui.Span(percent):fg(style.bg):bg(THEME.status.separator_style.bg),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ function Status:position()
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line {
|
return ui.Line {
|
||||||
ui.Span(string.format(" %2d/%-2d ", cursor + 1, length)):style(style),
|
ui.Span(string.format(" %2d/%-2d ", cursor + 1, length)):style(style),
|
||||||
ui.Span(THEME.status.separator.closing):fg(style.bg),
|
ui.Span(THEME.status.separator_close):fg(style.bg),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ function ui.highlight_ranges(s, ranges)
|
||||||
spans[#spans + 1] = ui.Span(s:sub(last + 1, r[1]))
|
spans[#spans + 1] = ui.Span(s:sub(last + 1, r[1]))
|
||||||
end
|
end
|
||||||
-- TODO: use a customable style
|
-- TODO: use a customable style
|
||||||
spans[#spans + 1] = ui.Span(s:sub(r[1] + 1, r[2])):fg("yellow"):italic()
|
spans[#spans + 1] = ui.Span(s:sub(r[1] + 1, r[2])):style(THEME.manager.find_keyword)
|
||||||
last = r[2]
|
last = r[2]
|
||||||
end
|
end
|
||||||
if last < #s then
|
if last < #s then
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue