Improve game rules configuration screen
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::constants::HIGHLIGHT_COLOR;
|
||||
use tui::buffer::Buffer;
|
||||
use tui::layout::Rect;
|
||||
use tui::style::{Color, Style};
|
||||
@ -37,7 +38,7 @@ impl Widget for ButtonWidget {
|
||||
let input = Paragraph::new(label.as_ref()).style(match (self.disabled, self.is_hovered) {
|
||||
(true, _) => Style::default(),
|
||||
(_, false) => Style::default().bg(Color::DarkGray),
|
||||
(_, true) => Style::default().fg(Color::White).bg(Color::Yellow),
|
||||
(_, true) => Style::default().fg(Color::White).bg(HIGHLIGHT_COLOR),
|
||||
});
|
||||
|
||||
input.render(area, buf);
|
||||
|
@ -1,7 +1,8 @@
|
||||
use crate::constants::HIGHLIGHT_COLOR;
|
||||
use std::fmt::Display;
|
||||
use tui::buffer::Buffer;
|
||||
use tui::layout::Rect;
|
||||
use tui::style::{Color, Style};
|
||||
use tui::style::*;
|
||||
use tui::widgets::*;
|
||||
|
||||
pub struct CheckboxWidget {
|
||||
@ -48,7 +49,7 @@ impl Widget for CheckboxWidget {
|
||||
|
||||
let input = Paragraph::new(paragraph.as_ref()).style(match &self.is_editing {
|
||||
false => Style::default(),
|
||||
true => Style::default().fg(Color::Yellow),
|
||||
true => Style::default().fg(HIGHLIGHT_COLOR),
|
||||
});
|
||||
|
||||
input.render(area, buf);
|
||||
|
@ -1,8 +1,9 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::constants::HIGHLIGHT_COLOR;
|
||||
use tui::buffer::Buffer;
|
||||
use tui::layout::Rect;
|
||||
use tui::style::{Color, Style};
|
||||
use tui::style::*;
|
||||
use tui::text::*;
|
||||
use tui::widgets::{Block, Borders, Paragraph, Widget};
|
||||
|
||||
@ -37,20 +38,25 @@ impl Widget for TextEditorWidget {
|
||||
self.value.to_string(),
|
||||
match &self.input_mode {
|
||||
InputMode::Normal => Style::default(),
|
||||
InputMode::Editing => Style::default().fg(Color::Yellow),
|
||||
InputMode::Editing => Style::default().fg(HIGHLIGHT_COLOR),
|
||||
},
|
||||
);
|
||||
|
||||
let mut spans = vec![span];
|
||||
|
||||
// Add cursor if field is highlighted
|
||||
if self.input_mode == InputMode::Editing {
|
||||
spans.push(Span::styled(" ", Style::default().bg(Color::Yellow)))
|
||||
spans.push(Span::styled(" ", Style::default().bg(HIGHLIGHT_COLOR)))
|
||||
}
|
||||
|
||||
let text = Text::from(Spans::from(spans));
|
||||
let input = Paragraph::new(text).block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_style(match self.input_mode {
|
||||
InputMode::Normal => Style::default(),
|
||||
InputMode::Editing => Style::default().fg(HIGHLIGHT_COLOR),
|
||||
})
|
||||
.title(self.label.as_ref()),
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user