1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-23 21:02:23 +00:00

feat(eckhart): Add vertical menu button styles

This commit is contained in:
Lukas Bielesch 2025-02-11 12:07:49 +01:00 committed by Lukáš Bielesch
parent a48061d36d
commit 0e4716ab30
2 changed files with 47 additions and 1 deletions

View File

@ -403,7 +403,7 @@ pub struct ButtonStyleSheet {
pub disabled: &'static ButtonStyle,
}
#[derive(PartialEq, Eq)]
#[derive(PartialEq, Eq, Clone)]
pub struct ButtonStyle {
pub font: Font,
pub text_color: Color,

View File

@ -40,6 +40,7 @@ pub const ORANGE_EXTRA_DARK: Color = Color::rgb(0x12, 0x07, 0x04);
pub const YELLOW: Color = Color::rgb(0xFF, 0xE4, 0x58);
pub const RED: Color = Color::rgb(0xFF, 0x30, 0x30);
pub const FATAL_ERROR_COLOR: Color = Color::rgb(0xE7, 0x0E, 0x0E);
pub const FATAL_ERROR_HIGHLIGHT_COLOR: Color = Color::rgb(0xFF, 0x41, 0x41);
@ -147,6 +148,10 @@ pub const fn label_title_main() -> TextStyle {
TEXT_SMALL
}
pub const fn label_menu_item_subtitle() -> TextStyle {
TextStyle::new(fonts::FONT_SATOSHI_REGULAR_22, GREY, BG, GREY, GREY)
}
// Button styles
pub const fn button_default() -> ButtonStyleSheet {
ButtonStyleSheet {
@ -252,6 +257,47 @@ pub const fn button_header() -> ButtonStyleSheet {
}
}
// Macro for styles differing only in text color
macro_rules! menu_item_title {
($color:expr) => {
ButtonStyleSheet {
normal: &ButtonStyle {
font: fonts::FONT_SATOSHI_REGULAR_38,
text_color: $color,
button_color: BG,
icon_color: $color,
background_color: BG,
},
active: &ButtonStyle {
font: fonts::FONT_SATOSHI_REGULAR_38,
text_color: $color,
button_color: BG,
icon_color: $color,
background_color: BG,
},
disabled: &ButtonStyle {
font: fonts::FONT_SATOSHI_REGULAR_38,
text_color: GREY_DARK,
button_color: BG,
icon_color: GREY_DARK,
background_color: BG,
},
}
};
}
pub const fn menu_item_title() -> ButtonStyleSheet {
menu_item_title!(GREY_LIGHT)
}
pub const fn menu_item_title_yellow() -> ButtonStyleSheet {
menu_item_title!(YELLOW)
}
pub const fn menu_item_title_red() -> ButtonStyleSheet {
menu_item_title!(RED)
}
// Result constants
pub const RESULT_PADDING: i16 = 6;
pub const RESULT_FOOTER_START: i16 = 171;