appcui 0.4.8

A feature-rich and cross-platform TUI/CUI framework for Rust, enabling modern terminal-based applications on Windows, Linux, and macOS. Includes built-in UI components like buttons, menus, list views, tree views, checkboxes, and more. Perfect for building fast and interactive CLI tools and text-based interfaces.
Documentation
use crate::{graphics::CharAttribute, system::MenuTheme};

#[repr(u8)]
#[derive(Copy, Clone, PartialEq)]
pub(super) enum MenuButtonState {
    Normal,
    Hovered,
    Pressed,
}
impl MenuButtonState {
    #[inline(always)]
    pub(super) fn get_color(&self, inactive: bool, color: &MenuTheme) -> CharAttribute {
        if inactive {
            color.text.inactive
        } else {
            match self {
                MenuButtonState::Normal => color.text.normal,
                MenuButtonState::Hovered => color.text.hovered,
                MenuButtonState::Pressed => color.text.pressed_or_selected,
            }
        }
    }
}