fresh/view/controls/
mod.rs1pub mod button;
22pub mod dropdown;
23pub mod keybinding_list;
24pub mod map_input;
25pub mod number_input;
26pub mod text_input;
27pub mod text_list;
28pub mod toggle;
29
30pub use button::{
31 render_button, render_button_row, ButtonColors, ButtonEvent, ButtonLayout, ButtonState,
32};
33pub use dropdown::{
34 render_dropdown, render_dropdown_aligned, DropdownColors, DropdownEvent, DropdownLayout,
35 DropdownState,
36};
37pub use keybinding_list::{
38 render_keybinding_list, KeybindingListColors, KeybindingListEvent, KeybindingListLayout,
39 KeybindingListState,
40};
41pub use map_input::{render_map, MapColors, MapEvent, MapLayout, MapState};
42pub use number_input::{
43 render_number_input, render_number_input_aligned, NumberInputColors, NumberInputEvent,
44 NumberInputLayout, NumberInputState,
45};
46pub use text_input::{
47 render_text_input, render_text_input_aligned, TextInputColors, TextInputEvent, TextInputLayout,
48 TextInputState,
49};
50pub use text_list::{
51 render_text_list, TextListColors, TextListEvent, TextListLayout, TextListState,
52};
53pub use toggle::{
54 render_toggle, render_toggle_aligned, ToggleColors, ToggleEvent, ToggleLayout, ToggleState,
55};
56
57use ratatui::style::Color;
58
59#[derive(Debug, Clone, Copy)]
61pub struct ControlColors {
62 pub bg: Color,
64 pub fg: Color,
66 pub border: Color,
68 pub accent: Color,
70 pub disabled: Color,
72}
73
74impl Default for ControlColors {
75 fn default() -> Self {
76 Self {
77 bg: Color::Black,
78 fg: Color::White,
79 border: Color::DarkGray,
80 accent: Color::Cyan,
81 disabled: Color::DarkGray,
82 }
83 }
84}
85
86impl ControlColors {
87 pub fn from_theme(theme: &crate::view::theme::Theme) -> Self {
89 Self {
90 bg: theme.editor_bg,
91 fg: theme.editor_fg,
92 border: theme.split_separator_fg,
93 accent: theme.selection_bg,
94 disabled: theme.line_number_fg,
95 }
96 }
97}
98
99#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
101pub enum FocusState {
102 #[default]
103 Normal,
104 Focused,
105 Hovered,
106 Disabled,
107}