From 9bec18733e1966a19d52ff9dc91030d08dbee0ca Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Tue, 4 Mar 2025 16:02:33 +0100 Subject: [PATCH] refactor(eckhart): update fonts and disabled button style --- .../ui/layout_eckhart/flow/confirm_reset.rs | 2 +- .../ui/layout_eckhart/flow/prompt_backup.rs | 2 +- .../src/ui/layout_eckhart/theme/firmware.rs | 42 ++++++++++++++++--- .../rust/src/ui/layout_eckhart/theme/mod.rs | 4 +- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs index fa5b55fd23..87895112b6 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs @@ -80,7 +80,7 @@ pub fn new_confirm_reset(recovery: bool) -> Result { let content_menu = VerticalMenuScreen::new( VerticalMenu::empty().item( Button::with_text(TR::buttons__cancel.into()) - .styled(theme::menu_item_title_red()) + .styled(theme::menu_item_title_orange()) .with_text_align(Alignment::Start) .with_content_offset(Offset::x(12)), ), diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs b/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs index f27cca0738..d152636896 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs @@ -77,7 +77,7 @@ pub fn new_prompt_backup() -> Result { let content_menu = VerticalMenuScreen::new( VerticalMenu::empty().item( Button::with_text(TR::backup__title_skip.into()) - .styled(theme::menu_item_title_red()) + .styled(theme::menu_item_title_orange()) .with_text_align(Alignment::Start) .with_content_offset(Offset::x(12)), ), diff --git a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs index dd21e61205..523461c024 100644 --- a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs @@ -1,4 +1,10 @@ -use crate::{time::Duration, ui::component::text::TextStyle}; +use crate::{ + time::Duration, + ui::component::text::{ + layout::{Chunks, LineBreaking, PageBreaking}, + TextStyle, + }, +}; use super::{ super::{ @@ -61,16 +67,42 @@ pub const TEXT_MONO_MEDIUM: TextStyle = TextStyle::new( /// Roboto Mono Light - 30 (Address, data) pub const TEXT_MONO_LIGHT: TextStyle = TextStyle::new( fonts::FONT_MONO_LIGHT_30, + GREY_LIGHT, + BG, + GREY_LIGHT, + GREY_LIGHT, +); + +pub const TEXT_MEDIUM_EXTRA_LIGHT: TextStyle = TextStyle::new( + fonts::FONT_SATOSHI_MEDIUM_26, GREY_EXTRA_LIGHT, BG, GREY_EXTRA_LIGHT, GREY_EXTRA_LIGHT, ); +pub const TEXT_SMALL_LIGHT: TextStyle = TextStyle::new( + fonts::FONT_SATOSHI_REGULAR_22, + GREY_LIGHT, + BG, + GREY_LIGHT, + GREY_LIGHT, +) +.with_line_spacing(-4); + +/// Makes sure that the displayed text (usually address) will get divided into +/// smaller chunks. +pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO_LIGHT + .with_chunks(Chunks::new(4, 8)) + .with_line_spacing(24); + +pub const TEXT_MONO_ADDRESS: TextStyle = TEXT_MONO_LIGHT + .with_line_breaking(LineBreaking::BreakWordsNoHyphen) + .with_page_breaking(PageBreaking::CutAndInsertEllipsis); + /// 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 + &TEXT_MONO_ADDRESS_CHUNKS } // Macro for styles differing only in text color @@ -243,8 +275,8 @@ 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 menu_item_title_orange() -> ButtonStyleSheet { + menu_item_title!(ORANGE) } pub const fn button_select_word() -> ButtonStyleSheet { diff --git a/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs b/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs index 96a1526b3b..f331ccdb71 100644 --- a/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs +++ b/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs @@ -113,9 +113,9 @@ pub const fn button_default() -> ButtonStyleSheet { disabled: &ButtonStyle { font: fonts::FONT_SATOSHI_MEDIUM_26, text_color: GREY_LIGHT, - button_color: GREY_DARK, + button_color: BG, icon_color: GREY_LIGHT, - background_color: GREY_DARK, + background_color: BG, }, } }