Fixing color schemes

This commit is contained in:
2026-01-30 20:15:43 +01:00
parent 44d1e9af24
commit eb3969b952
22 changed files with 2888 additions and 482 deletions

View File

@@ -1,4 +1,4 @@
use crate::theme::editor_widget;
use crate::theme;
use ratatui::{
layout::Rect,
style::{Modifier, Style},
@@ -333,9 +333,10 @@ impl Editor {
}
pub fn render(&self, frame: &mut Frame, area: Rect, highlighter: Highlighter) {
let t = theme::get();
let (cursor_row, cursor_col) = self.text.cursor();
let cursor_style = Style::default().bg(editor_widget::CURSOR_BG).fg(editor_widget::CURSOR_FG);
let selection_style = Style::default().bg(editor_widget::SELECTION_BG);
let cursor_style = Style::default().bg(t.editor_widget.cursor_bg).fg(t.editor_widget.cursor_fg);
let selection_style = Style::default().bg(t.editor_widget.selection_bg);
let selection = self.text.selection_range();
@@ -383,6 +384,7 @@ impl Editor {
}
fn render_completion(&self, frame: &mut Frame, editor_area: Rect, cursor_row: usize) {
let t = theme::get();
let max_visible: usize = 6;
let list_width: u16 = 18;
let doc_width: u16 = 40;
@@ -413,9 +415,9 @@ impl Editor {
let list_area = Rect::new(popup_x, popup_y, list_width, total_height);
frame.render_widget(Clear, list_area);
let highlight_style = Style::default().fg(editor_widget::COMPLETION_SELECTED).add_modifier(Modifier::BOLD);
let normal_style = Style::default().fg(editor_widget::COMPLETION_FG);
let bg_style = Style::default().bg(editor_widget::COMPLETION_BG);
let highlight_style = Style::default().fg(t.editor_widget.completion_selected).add_modifier(Modifier::BOLD);
let normal_style = Style::default().fg(t.editor_widget.completion_fg);
let bg_style = Style::default().bg(t.editor_widget.completion_bg);
let list_lines: Vec<Line> = (scroll_offset..scroll_offset + visible_count)
.map(|i| {
@@ -428,7 +430,7 @@ impl Editor {
};
let prefix = if i == self.completion.cursor { "> " } else { " " };
let display = format!("{prefix}{name:<width$}", width = list_width as usize - 2);
Line::from(Span::styled(display, style.bg(editor_widget::COMPLETION_BG)))
Line::from(Span::styled(display, style.bg(t.editor_widget.completion_bg)))
})
.collect();
@@ -451,15 +453,15 @@ impl Editor {
let candidate = &self.completion.candidates[selected_idx];
let name_style = Style::default()
.fg(editor_widget::COMPLETION_SELECTED)
.fg(t.editor_widget.completion_selected)
.add_modifier(Modifier::BOLD)
.bg(editor_widget::COMPLETION_BG);
.bg(t.editor_widget.completion_bg);
let desc_style = Style::default()
.fg(editor_widget::COMPLETION_FG)
.bg(editor_widget::COMPLETION_BG);
.fg(t.editor_widget.completion_fg)
.bg(t.editor_widget.completion_bg);
let example_style = Style::default()
.fg(editor_widget::COMPLETION_EXAMPLE)
.bg(editor_widget::COMPLETION_BG);
.fg(t.editor_widget.completion_example)
.bg(t.editor_widget.completion_bg);
let w = doc_width as usize;
let mut doc_lines: Vec<Line> = Vec::new();