wip: need to set the default for Palette in the plugins

This commit is contained in:
denis 2021-03-31 09:44:41 +03:00
parent 42890d4e64
commit 2b59edbe9d
2 changed files with 28 additions and 2 deletions

View File

@ -256,7 +256,7 @@ impl InputHandler {
// TODO this should probably be automatically generated in some way
pub fn get_mode_info(mode: InputMode) -> ModeInfo {
let mut keybinds: Vec<(String, String)> = vec![];
let mut palette = load_palette();
let palette = load_palette();
match mode {
InputMode::Normal | InputMode::Locked => {}
InputMode::Resize => {

View File

@ -58,7 +58,16 @@ impl Default for InputMode {
}
}
#[derive(Clone, Copy, Default, Debug, Serialize, Deserialize)]
pub mod colors {
pub const WHITE: (u8, u8, u8) = (238, 238, 238);
pub const GREEN: (u8, u8, u8) = (175, 255, 0);
pub const GRAY: (u8, u8, u8) = (68, 68, 68);
pub const BRIGHT_GRAY: (u8, u8, u8) = (138, 138, 138);
pub const RED: (u8, u8, u8) = (135, 0, 0);
pub const BLACK: (u8, u8, u8) = (0, 0, 0);
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub struct Palette {
pub fg: (u8, u8, u8),
pub bg: (u8, u8, u8),
@ -72,6 +81,23 @@ pub struct Palette {
pub white: (u8, u8, u8),
}
impl Default for Palette {
fn default() -> Palette {
Palette {
fg: colors::BRIGHT_GRAY,
bg: colors::BLACK,
black: colors::BLACK,
red: colors::RED,
green: colors::GREEN,
yellow: colors::GRAY,
blue: colors::GRAY,
magenta: colors::GRAY,
cyan: colors::GRAY,
white: colors::WHITE,
}
}
}
/// Represents the contents of the help message that is printed in the status bar,
/// which indicates the current [`InputMode`] and what the keybinds for that mode
/// are. Related to the default `status-bar` plugin.