mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-03 16:56:07 +00:00
refactor(eckhart): separate theme to fw and bld
This commit is contained in:
parent
4d01975496
commit
1d2278d1e3
@ -38,7 +38,10 @@ pub struct Button {
|
||||
|
||||
impl Button {
|
||||
const LINE_SPACING: i16 = 7;
|
||||
#[cfg(not(feature = "bootloader"))]
|
||||
const SUBTEXT_STYLE: TextStyle = theme::label_menu_item_subtitle();
|
||||
#[cfg(feature = "bootloader")]
|
||||
const SUBTEXT_STYLE: TextStyle = theme::bootloader::TEXT_NORMAL;
|
||||
|
||||
pub const fn new(content: ButtonContent) -> Self {
|
||||
Self {
|
||||
|
@ -6,10 +6,12 @@ use crate::ui::{
|
||||
util::include_res,
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
component::{ButtonStyle, ButtonStyleSheet, ResultStyle},
|
||||
fonts,
|
||||
theme::{BLACK, FG, GREY_DARK, GREY_LIGHT, WHITE},
|
||||
use super::{
|
||||
super::{
|
||||
component::{ButtonStyle, ButtonStyleSheet, ResultStyle},
|
||||
fonts,
|
||||
},
|
||||
BLACK, GREY_DARK, GREY_LIGHT, GREY_SUPER_DARK, WHITE,
|
||||
};
|
||||
|
||||
pub const BLD_BG: Color = Color::rgb(0x00, 0x1E, 0xAD);
|
||||
@ -89,10 +91,36 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: FG,
|
||||
text_color: BLD_FG,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: BLD_BG,
|
||||
background_color: FG,
|
||||
background_color: BLD_FG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_header() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BLD_BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BLD_BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -141,10 +169,10 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: FG,
|
||||
text_color: BLD_FG,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: FG,
|
||||
background_color: FG,
|
||||
icon_color: BLD_FG,
|
||||
background_color: BLD_FG,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -260,4 +288,4 @@ pub const RESULT_WIPE: ResultStyle = ResultStyle::new(
|
||||
pub const RESULT_FW_INSTALL: ResultStyle = ResultStyle::new(BLD_FG, BLD_BG, BLD_BTN_COLOR);
|
||||
|
||||
pub const RESULT_INITIAL: ResultStyle =
|
||||
ResultStyle::new(FG, WELCOME_COLOR, WELCOME_HIGHLIGHT_COLOR);
|
||||
ResultStyle::new(BLD_FG, WELCOME_COLOR, WELCOME_HIGHLIGHT_COLOR);
|
||||
|
459
core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs
Normal file
459
core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs
Normal file
@ -0,0 +1,459 @@
|
||||
use crate::{time::Duration, ui::component::text::TextStyle};
|
||||
|
||||
use super::{
|
||||
super::{
|
||||
component::{ButtonStyle, ButtonStyleSheet},
|
||||
fonts,
|
||||
},
|
||||
*,
|
||||
};
|
||||
|
||||
pub const CONFIRM_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
||||
pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
||||
|
||||
// Text styles
|
||||
/// Alias for use with copied code, might be deleted later
|
||||
pub const TEXT_NORMAL: TextStyle = TEXT_MEDIUM;
|
||||
/// TT Satoshi Extra Light - 72 (PIN keyboard, Wallet backup / word)
|
||||
pub const TEXT_SUPER_BIG: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Extra Light - 46 (Char keyboard, Backup check)
|
||||
pub const TEXT_BIG: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Regular - 38 (Screen text, Menu item label)
|
||||
pub const TEXT_REGULAR: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_REGULAR_38,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Medium - 26 (Screen text, Button label, Input value)
|
||||
pub const TEXT_MEDIUM: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
GREY_LIGHT,
|
||||
BG,
|
||||
GREY_LIGHT,
|
||||
GREY_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Regular - 22 (Screen title, Hint, PageCounter, Secondary info)
|
||||
/// with negative line spacing to make it more compact
|
||||
pub const TEXT_SMALL: TextStyle =
|
||||
TextStyle::new(fonts::FONT_SATOSHI_REGULAR_22, GREY, BG, GREY, GREY).with_line_spacing(-4);
|
||||
/// Roboto Mono Medium - 38 (Number value)
|
||||
pub const TEXT_MONO_MEDIUM: TextStyle = TextStyle::new(
|
||||
fonts::FONT_MONO_MEDIUM_38,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// Roboto Mono Light - 30 (Address, data)
|
||||
pub const TEXT_MONO_LIGHT: TextStyle = TextStyle::new(
|
||||
fonts::FONT_MONO_LIGHT_30,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
|
||||
/// Decide the text style of chunkified text according to its length.
|
||||
pub fn get_chunkified_text_style(_character_length: usize) -> &'static TextStyle {
|
||||
// TODO: implement properly for Eckhart, see Delizia implemenation
|
||||
&TEXT_MONO_MEDIUM
|
||||
}
|
||||
|
||||
// Macro for styles differing only in text color
|
||||
macro_rules! label_title {
|
||||
($color:expr) => {
|
||||
TextStyle::new(fonts::FONT_SATOSHI_REGULAR_22, $color, BG, $color, $color)
|
||||
.with_line_spacing(-4)
|
||||
};
|
||||
}
|
||||
|
||||
pub const fn label_title_main() -> TextStyle {
|
||||
label_title!(GREY)
|
||||
}
|
||||
|
||||
pub const fn label_title_confirm() -> TextStyle {
|
||||
label_title!(GREEN_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_title_danger() -> TextStyle {
|
||||
label_title!(ORANGE)
|
||||
}
|
||||
|
||||
pub const fn label_title_warning() -> TextStyle {
|
||||
label_title!(YELLOW)
|
||||
}
|
||||
|
||||
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_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREEN,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: GREY_DARK,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: ORANGE, // unused
|
||||
button_color: BG,
|
||||
icon_color: ORANGE,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: ORANGE_DIMMED, //unused
|
||||
button_color: ORANGE_EXTRA_DARK,
|
||||
icon_color: ORANGE_DIMMED,
|
||||
background_color: ORANGE_EXTRA_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREY_EXTRA_DARK, // unused
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_warning_high() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: ORANGE,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: ORANGE,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREEN,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: ORANGE,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: GREY_DARK,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_header() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 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: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
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)
|
||||
}
|
||||
|
||||
pub const fn button_select_word() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
// unused
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_EXTRA_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard_numeric() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
text_color: GREY_EXTRA_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREEN_LIGHT, // unused
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREEN, // unused
|
||||
button_color: GREEN_EXTRA_DARK,
|
||||
icon_color: GREEN,
|
||||
background_color: GREEN_EXTRA_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREY_EXTRA_DARK, // unused
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard_next() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn input_mnemonic() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn input_mnemonic_suggestion() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn input_mnemonic_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN_LIGHT,
|
||||
button_color: GREEN_EXTRA_DARK,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: GREEN_EXTRA_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
// unused
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
@ -1,20 +1,18 @@
|
||||
pub mod bootloader;
|
||||
|
||||
pub mod backlight;
|
||||
#[cfg(feature = "bootloader")]
|
||||
pub mod bootloader;
|
||||
#[cfg(feature = "micropython")]
|
||||
pub mod firmware;
|
||||
#[cfg(feature = "micropython")]
|
||||
pub use firmware::*;
|
||||
|
||||
use crate::{
|
||||
time::Duration,
|
||||
ui::{component::text::TextStyle, display::Color, util::include_icon},
|
||||
};
|
||||
use crate::ui::{display::Color, util::include_icon};
|
||||
|
||||
use super::{
|
||||
component::{ButtonStyle, ButtonStyleSheet, ResultStyle},
|
||||
fonts,
|
||||
};
|
||||
|
||||
pub const CONFIRM_HOLD_DURATION: Duration = Duration::from_millis(2000);
|
||||
pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
||||
|
||||
// Color palette.
|
||||
pub const WHITE: Color = Color::rgb(0xFF, 0xFF, 0xFF);
|
||||
pub const BLACK: Color = Color::rgb(0, 0, 0);
|
||||
@ -96,97 +94,6 @@ include_icon!(ICON_BORDER_TR, "layout_eckhart/res/border/TR.toif");
|
||||
include_icon!(ICON_PLUS, "layout_eckhart/res/plus.toif");
|
||||
include_icon!(ICON_MINUS, "layout_eckhart/res/minus.toif");
|
||||
|
||||
// Text styles
|
||||
/// Alias for use with copied code, might be deleted later
|
||||
pub const TEXT_NORMAL: TextStyle = TEXT_MEDIUM;
|
||||
/// TT Satoshi Extra Light - 72 (PIN keyboard, Wallet backup / word)
|
||||
pub const TEXT_SUPER_BIG: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Extra Light - 46 (Char keyboard, Backup check)
|
||||
pub const TEXT_BIG: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Regular - 38 (Screen text, Menu item label)
|
||||
pub const TEXT_REGULAR: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_REGULAR_38,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Medium - 26 (Screen text, Button label, Input value)
|
||||
pub const TEXT_MEDIUM: TextStyle = TextStyle::new(
|
||||
fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
GREY_LIGHT,
|
||||
BG,
|
||||
GREY_LIGHT,
|
||||
GREY_LIGHT,
|
||||
);
|
||||
/// TT Satoshi Regular - 22 (Screen title, Hint, PageCounter, Secondary info)
|
||||
/// with negative line spacing to make it more compact
|
||||
pub const TEXT_SMALL: TextStyle =
|
||||
TextStyle::new(fonts::FONT_SATOSHI_REGULAR_22, GREY, BG, GREY, GREY).with_line_spacing(-4);
|
||||
/// Roboto Mono Medium - 38 (Number value)
|
||||
pub const TEXT_MONO_MEDIUM: TextStyle = TextStyle::new(
|
||||
fonts::FONT_MONO_MEDIUM_38,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
/// Roboto Mono Light - 30 (Address, data)
|
||||
pub const TEXT_MONO_LIGHT: TextStyle = TextStyle::new(
|
||||
fonts::FONT_MONO_LIGHT_30,
|
||||
GREY_EXTRA_LIGHT,
|
||||
BG,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_EXTRA_LIGHT,
|
||||
);
|
||||
|
||||
/// Decide the text style of chunkified text according to its length.
|
||||
pub fn get_chunkified_text_style(_character_length: usize) -> &'static TextStyle {
|
||||
// TODO: implement properly for Eckhart, see Delizia implemenation
|
||||
&TEXT_MONO_MEDIUM
|
||||
}
|
||||
|
||||
// Macro for styles differing only in text color
|
||||
macro_rules! label_title {
|
||||
($color:expr) => {
|
||||
TextStyle::new(fonts::FONT_SATOSHI_REGULAR_22, $color, BG, $color, $color)
|
||||
.with_line_spacing(-4)
|
||||
};
|
||||
}
|
||||
|
||||
pub const fn label_title_main() -> TextStyle {
|
||||
label_title!(GREY)
|
||||
}
|
||||
|
||||
pub const fn label_title_confirm() -> TextStyle {
|
||||
label_title!(GREEN_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_title_danger() -> TextStyle {
|
||||
label_title!(ORANGE)
|
||||
}
|
||||
|
||||
pub const fn label_title_warning() -> TextStyle {
|
||||
label_title!(YELLOW)
|
||||
}
|
||||
|
||||
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 {
|
||||
normal: &ButtonStyle {
|
||||
@ -213,362 +120,7 @@ pub const fn button_default() -> ButtonStyleSheet {
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREEN,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: GREY_DARK,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: ORANGE, // unused
|
||||
button_color: BG,
|
||||
icon_color: ORANGE,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: ORANGE_DIMMED, //unused
|
||||
button_color: ORANGE_EXTRA_DARK,
|
||||
icon_color: ORANGE_DIMMED,
|
||||
background_color: ORANGE_EXTRA_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREY_EXTRA_DARK, // unused
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_warning_high() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: ORANGE,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: ORANGE,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREEN,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: ORANGE,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: GREY_DARK,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_header() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 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: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
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)
|
||||
}
|
||||
pub const fn button_select_word() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
// unused
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_46,
|
||||
text_color: GREY_EXTRA_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard_numeric() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_EXTRALIGHT_72,
|
||||
text_color: GREY_EXTRA_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREEN_LIGHT, // unused
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREEN, // unused
|
||||
button_color: GREEN_EXTRA_DARK,
|
||||
icon_color: GREEN,
|
||||
background_color: GREEN_EXTRA_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_REGULAR_22, // unused
|
||||
text_color: GREY_EXTRA_DARK, // unused
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn button_keyboard_next() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_DARK,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn input_mnemonic() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_SUPER_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: GREY_SUPER_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn input_mnemonic_suggestion() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn input_mnemonic_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: GREEN_LIGHT,
|
||||
button_color: GREEN_EXTRA_DARK,
|
||||
icon_color: GREEN_LIGHT,
|
||||
background_color: GREEN_EXTRA_DARK,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
// unused
|
||||
font: fonts::FONT_SATOSHI_MEDIUM_26,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Result constants
|
||||
// Result constants
|
||||
pub const RESULT_PADDING: i16 = 6;
|
||||
pub const RESULT_FOOTER_START: i16 = 171;
|
||||
pub const RESULT_FOOTER_HEIGHT: i16 = 62;
|
||||
|
Loading…
Reference in New Issue
Block a user