mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
merge input into theme system
This commit is contained in:
parent
85a83ff731
commit
7a2384934d
2 changed files with 12 additions and 7 deletions
|
|
@ -2,7 +2,8 @@ use core::{input::InputMode, Ctx};
|
|||
use std::ops::Range;
|
||||
|
||||
use ansi_to_tui::IntoText;
|
||||
use ratatui::{buffer::Buffer, layout::Rect, style::{Color, Style}, text::{Line, Text}, widgets::{Block, BorderType, Borders, Clear, Paragraph, Widget}};
|
||||
use config::THEME;
|
||||
use ratatui::{buffer::Buffer, layout::Rect, text::{Line, Text}, widgets::{Block, BorderType, Borders, Clear, Paragraph, Widget}};
|
||||
use shared::Term;
|
||||
|
||||
pub(crate) struct Input<'a> {
|
||||
|
|
@ -30,14 +31,14 @@ impl<'a> Widget for Input<'a> {
|
|||
Block::new()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(Style::new().fg(Color::Blue))
|
||||
.border_style(THEME.input.border.get())
|
||||
.title({
|
||||
let mut line = Line::from(input.title());
|
||||
line.patch_style(Style::new().fg(Color::White));
|
||||
line.patch_style(THEME.input.title.get());
|
||||
line
|
||||
}),
|
||||
)
|
||||
.style(Style::new().fg(Color::White))
|
||||
.style(THEME.input.text.get())
|
||||
.render(area, buf);
|
||||
|
||||
if let Some(Range { start, end }) = input.selected() {
|
||||
|
|
@ -46,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) },
|
||||
Style::new().bg(Color::Rgb(72, 77, 102)),
|
||||
THEME.input.visual.get(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use core::{tasks::TASKS_PERCENT, Ctx};
|
||||
|
||||
use config::THEME;
|
||||
use ratatui::{buffer::Buffer, layout::{self, Alignment, Constraint, Direction, Rect}, widgets::{Block, BorderType, Borders, List, ListItem, Padding, Widget}};
|
||||
use ratatui::{buffer::Buffer, layout::{self, Alignment, Constraint, Direction, Rect}, text::Line, widgets::{Block, BorderType, Borders, List, ListItem, Padding, Widget}};
|
||||
|
||||
use super::Clear;
|
||||
|
||||
|
|
@ -39,7 +39,11 @@ impl<'a> Widget for Layout<'a> {
|
|||
|
||||
Clear.render(area, buf);
|
||||
let block = Block::new()
|
||||
.title("Tasks")
|
||||
.title({
|
||||
let mut line = Line::from("Tasks".to_string());
|
||||
line.patch_style(THEME.tasks.title.get());
|
||||
line
|
||||
})
|
||||
.title_alignment(Alignment::Center)
|
||||
.padding(Padding::new(0, 0, 1, 1))
|
||||
// Maybe also add these border type in to the later theme system
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue