mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-12 15:42:40 +00:00
refactor(core): do not expose fonts outside layouts
- common components now take Font as a parameter, e.g. shape::Text - FormattedText now does not have `text_normal(txt)`, `text_bold(txt)` methods etc. but we use `text(txt, font)` instead [no changelog]
This commit is contained in:
parent
e73ca8b481
commit
991b3662f0
@ -2,7 +2,7 @@ use crate::{
|
|||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Pad},
|
component::{Component, Event, EventCtx, Never, Pad},
|
||||||
display::{font::FONT_NORMAL, Color},
|
display::{Color, Font},
|
||||||
geometry::{Alignment, Offset, Rect},
|
geometry::{Alignment, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
@ -12,10 +12,11 @@ pub struct Connect {
|
|||||||
fg: Color,
|
fg: Color,
|
||||||
bg: Pad,
|
bg: Pad,
|
||||||
message: TString<'static>,
|
message: TString<'static>,
|
||||||
|
font: Font,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Connect {
|
impl Connect {
|
||||||
pub fn new<T>(message: T, fg: Color, bg: Color) -> Self
|
pub fn new<T>(message: T, font: Font, fg: Color, bg: Color) -> Self
|
||||||
where
|
where
|
||||||
T: Into<TString<'static>>,
|
T: Into<TString<'static>>,
|
||||||
{
|
{
|
||||||
@ -23,6 +24,7 @@ impl Connect {
|
|||||||
fg,
|
fg,
|
||||||
bg: Pad::with_background(bg),
|
bg: Pad::with_background(bg),
|
||||||
message: message.into(),
|
message: message.into(),
|
||||||
|
font,
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.bg.clear();
|
instance.bg.clear();
|
||||||
@ -43,16 +45,17 @@ impl Component for Connect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
let font = FONT_NORMAL;
|
|
||||||
|
|
||||||
self.bg.render(target);
|
self.bg.render(target);
|
||||||
|
|
||||||
self.message.map(|t| {
|
self.message.map(|t| {
|
||||||
shape::Text::new(self.bg.area.center() + Offset::y(font.text_height() / 2), t)
|
shape::Text::new(
|
||||||
.with_fg(self.fg)
|
self.bg.area.center() + Offset::y(self.font.text_height() / 2),
|
||||||
.with_font(font)
|
t,
|
||||||
.with_align(Alignment::Center)
|
self.font,
|
||||||
.render(target);
|
)
|
||||||
|
.with_fg(self.fg)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.render(target);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,7 @@ impl Marquee {
|
|||||||
let text_height = self.font.text_height();
|
let text_height = self.font.text_height();
|
||||||
let pos = self.area.top_left() + Offset::new(offset, text_height - 1);
|
let pos = self.area.top_left() + Offset::new(offset, text_height - 1);
|
||||||
self.text.map(|t| {
|
self.text.map(|t| {
|
||||||
shape::Text::new(pos, t)
|
shape::Text::new(pos, t, self.font)
|
||||||
.with_font(self.font)
|
|
||||||
.with_fg(self.fg)
|
.with_fg(self.fg)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
@ -511,16 +511,14 @@ where
|
|||||||
R: Renderer<'s>,
|
R: Renderer<'s>,
|
||||||
{
|
{
|
||||||
fn text(&mut self, cursor: Point, layout: &TextLayout, text: &str) {
|
fn text(&mut self, cursor: Point, layout: &TextLayout, text: &str) {
|
||||||
shape::Text::new(cursor, text)
|
shape::Text::new(cursor, text, layout.style.text_font)
|
||||||
.with_font(layout.style.text_font)
|
|
||||||
.with_fg(layout.style.text_color)
|
.with_fg(layout.style.text_color)
|
||||||
.with_alpha(self.alpha)
|
.with_alpha(self.alpha)
|
||||||
.render(self.renderer);
|
.render(self.renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hyphen(&mut self, cursor: Point, layout: &TextLayout) {
|
fn hyphen(&mut self, cursor: Point, layout: &TextLayout) {
|
||||||
shape::Text::new(cursor, "-")
|
shape::Text::new(cursor, "-", layout.style.text_font)
|
||||||
.with_font(layout.style.text_font)
|
|
||||||
.with_fg(layout.style.hyphen_color)
|
.with_fg(layout.style.hyphen_color)
|
||||||
.with_alpha(self.alpha)
|
.with_alpha(self.alpha)
|
||||||
.render(self.renderer);
|
.render(self.renderer);
|
||||||
@ -535,8 +533,7 @@ where
|
|||||||
.with_alpha(self.alpha)
|
.with_alpha(self.alpha)
|
||||||
.render(self.renderer);
|
.render(self.renderer);
|
||||||
} else {
|
} else {
|
||||||
shape::Text::new(cursor, ELLIPSIS)
|
shape::Text::new(cursor, ELLIPSIS, layout.style.text_font)
|
||||||
.with_font(layout.style.text_font)
|
|
||||||
.with_fg(layout.style.ellipsis_color)
|
.with_fg(layout.style.ellipsis_color)
|
||||||
.with_alpha(self.alpha)
|
.with_alpha(self.alpha)
|
||||||
.render(self.renderer);
|
.render(self.renderer);
|
||||||
@ -551,8 +548,7 @@ where
|
|||||||
.with_alpha(self.alpha)
|
.with_alpha(self.alpha)
|
||||||
.render(self.renderer);
|
.render(self.renderer);
|
||||||
} else {
|
} else {
|
||||||
shape::Text::new(cursor, ELLIPSIS)
|
shape::Text::new(cursor, ELLIPSIS, layout.style.text_font)
|
||||||
.with_font(layout.style.text_font)
|
|
||||||
.with_fg(layout.style.ellipsis_color)
|
.with_fg(layout.style.ellipsis_color)
|
||||||
.with_alpha(self.alpha)
|
.with_alpha(self.alpha)
|
||||||
.render(self.renderer);
|
.render(self.renderer);
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
display::{
|
display::{Color, Font},
|
||||||
font::{FONT_BOLD, FONT_BOLD_UPPER, FONT_DEMIBOLD, FONT_MONO, FONT_NORMAL},
|
|
||||||
Color, Font,
|
|
||||||
},
|
|
||||||
geometry::{Alignment, Offset, Rect},
|
geometry::{Alignment, Offset, Rect},
|
||||||
util::ResultExt,
|
util::ResultExt,
|
||||||
},
|
},
|
||||||
@ -111,13 +108,14 @@ impl<'a> OpTextLayout<'a> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Drawing text
|
// Drawing text
|
||||||
Op::Text(text, continued) => {
|
Op::Text(text, font, continued) => {
|
||||||
// Try to fit text on the current page and if they do not fit,
|
// Try to fit text on the current page and if they do not fit,
|
||||||
// return the appropriate OutOfBounds message
|
// return the appropriate OutOfBounds message
|
||||||
|
|
||||||
// Inserting the ellipsis at the very beginning of the text if needed
|
// Inserting the ellipsis at the very beginning of the text if needed
|
||||||
// (just for incomplete texts that were separated)
|
// (just for incomplete texts that were separated)
|
||||||
layout.continues_from_prev_page = continued;
|
layout.continues_from_prev_page = continued;
|
||||||
|
layout.style.text_font = font;
|
||||||
|
|
||||||
let fit = text.map(|t| layout.layout_text(t, cursor, sink));
|
let fit = text.map(|t| layout.layout_text(t, cursor, sink));
|
||||||
|
|
||||||
@ -162,7 +160,7 @@ impl<'a> OpTextLayout<'a> {
|
|||||||
let mut skipped = 0;
|
let mut skipped = 0;
|
||||||
ops_iter.filter_map(move |op| {
|
ops_iter.filter_map(move |op| {
|
||||||
match op {
|
match op {
|
||||||
Op::Text(text, _continued) if skipped < skip_bytes => {
|
Op::Text(text, font, _continued) if skipped < skip_bytes => {
|
||||||
let skip_text_bytes_if_fits_partially = skip_bytes - skipped;
|
let skip_text_bytes_if_fits_partially = skip_bytes - skipped;
|
||||||
skipped = skipped.saturating_add(text.len());
|
skipped = skipped.saturating_add(text.len());
|
||||||
if skipped > skip_bytes {
|
if skipped > skip_bytes {
|
||||||
@ -171,6 +169,7 @@ impl<'a> OpTextLayout<'a> {
|
|||||||
// Signifying that the text continues from previous page
|
// Signifying that the text continues from previous page
|
||||||
Some(Op::Text(
|
Some(Op::Text(
|
||||||
text.skip_prefix(skip_text_bytes_if_fits_partially),
|
text.skip_prefix(skip_text_bytes_if_fits_partially),
|
||||||
|
font,
|
||||||
true,
|
true,
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
@ -201,26 +200,24 @@ impl<'a> OpTextLayout<'a> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn text(self, text: TString<'a>) -> Self {
|
pub fn text(self, text: impl Into<TString<'a>>, font: Font) -> Self {
|
||||||
self.with_new_item(Op::Text(text, false))
|
self.with_new_item(Op::Text(text.into(), font, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn newline(self) -> Self {
|
pub fn newline(self) -> Self {
|
||||||
self.text("\n".into())
|
let font = self.layout.style.text_font;
|
||||||
|
self.text("\n", font)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn newline_half(self) -> Self {
|
pub fn newline_half(self) -> Self {
|
||||||
self.text("\r".into())
|
let font = self.layout.style.text_font;
|
||||||
|
self.text("\r", font)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_page(self) -> Self {
|
pub fn next_page(self) -> Self {
|
||||||
self.with_new_item(Op::NextPage)
|
self.with_new_item(Op::NextPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn font(self, font: Font) -> Self {
|
|
||||||
self.with_new_item(Op::Font(font))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn offset(self, offset: Offset) -> Self {
|
pub fn offset(self, offset: Offset) -> Self {
|
||||||
self.with_new_item(Op::CursorOffset(offset))
|
self.with_new_item(Op::CursorOffset(offset))
|
||||||
}
|
}
|
||||||
@ -240,31 +237,6 @@ impl<'a> OpTextLayout<'a> {
|
|||||||
pub fn line_spacing(self, spacing: i16) -> Self {
|
pub fn line_spacing(self, spacing: i16) -> Self {
|
||||||
self.with_new_item(Op::LineSpacing(spacing))
|
self.with_new_item(Op::LineSpacing(spacing))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Op-adding aggregation operations
|
|
||||||
impl<'a> OpTextLayout<'a> {
|
|
||||||
// TODO: use TextStyle instead because we do not want e.g. BOLD_UPPER in all
|
|
||||||
// layouts
|
|
||||||
pub fn text_normal(self, text: impl Into<TString<'a>>) -> Self {
|
|
||||||
self.font(FONT_NORMAL).text(text.into())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn text_mono(self, text: impl Into<TString<'a>>) -> Self {
|
|
||||||
self.font(FONT_MONO).text(text.into())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn text_bold(self, text: impl Into<TString<'a>>) -> Self {
|
|
||||||
self.font(FONT_BOLD).text(text.into())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn text_bold_upper(self, text: impl Into<TString<'a>>) -> Self {
|
|
||||||
self.font(FONT_BOLD_UPPER).text(text.into())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn text_demibold(self, text: impl Into<TString<'a>>) -> Self {
|
|
||||||
self.font(FONT_DEMIBOLD).text(text.into())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn chunkify_text(self, chunks: Option<(Chunks, i16)>) -> Self {
|
pub fn chunkify_text(self, chunks: Option<(Chunks, i16)>) -> Self {
|
||||||
if let Some(chunks) = chunks {
|
if let Some(chunks) = chunks {
|
||||||
@ -277,10 +249,10 @@ impl<'a> OpTextLayout<'a> {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum Op<'a> {
|
pub enum Op<'a> {
|
||||||
/// Render text with current color and font.
|
/// Render text with current color and specified font.
|
||||||
/// Bool signifies whether this is a split Text Op continued from previous
|
/// Bool signifies whether this is a split Text Op continued from previous
|
||||||
/// page. If true, a leading ellipsis will be rendered.
|
/// page. If true, a leading ellipsis will be rendered.
|
||||||
Text(TString<'a>, bool),
|
Text(TString<'a>, Font, bool),
|
||||||
/// Set current text color.
|
/// Set current text color.
|
||||||
Color(Color),
|
Color(Color),
|
||||||
/// Set currently used font.
|
/// Set currently used font.
|
||||||
|
@ -4,11 +4,7 @@ use crate::{
|
|||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Paginate},
|
component::{Component, Event, EventCtx, Never, Paginate},
|
||||||
display::{
|
display::{font::Font, toif::Icon, Color},
|
||||||
font::{FONT_NORMAL, FONT_SUB},
|
|
||||||
toif::Icon,
|
|
||||||
Color,
|
|
||||||
},
|
|
||||||
geometry::{Alignment, Dimensions, Insets, LinearPlacement, Offset, Point, Rect},
|
geometry::{Alignment, Dimensions, Insets, LinearPlacement, Offset, Point, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
@ -559,13 +555,15 @@ pub struct Checklist<T> {
|
|||||||
icon_current: Icon,
|
icon_current: Icon,
|
||||||
icon_done: Icon,
|
icon_done: Icon,
|
||||||
icon_done_color: Option<Color>,
|
icon_done_color: Option<Color>,
|
||||||
show_numerals: bool,
|
numeral_font: Option<Font>,
|
||||||
/// How wide will the left icon column be
|
/// How wide will the left icon column be
|
||||||
check_width: i16,
|
check_width: i16,
|
||||||
/// Offset of the icon representing DONE
|
/// Offset of the icon representing DONE
|
||||||
done_offset: Offset,
|
done_offset: Offset,
|
||||||
/// Offset of the icon representing CURRENT
|
/// Offset of the icon representing CURRENT
|
||||||
current_offset: Offset,
|
current_offset: Offset,
|
||||||
|
/// Offset of the numeral representing the ordinal number of the task
|
||||||
|
numeral_offset: Offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Checklist<T>
|
impl<'a, T> Checklist<T>
|
||||||
@ -585,10 +583,11 @@ where
|
|||||||
icon_current,
|
icon_current,
|
||||||
icon_done,
|
icon_done,
|
||||||
icon_done_color: None,
|
icon_done_color: None,
|
||||||
show_numerals: false,
|
numeral_font: None,
|
||||||
check_width: 0,
|
check_width: 0,
|
||||||
done_offset: Offset::zero(),
|
done_offset: Offset::zero(),
|
||||||
current_offset: Offset::zero(),
|
current_offset: Offset::zero(),
|
||||||
|
numeral_offset: Offset::zero(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,8 +611,13 @@ where
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_numerals(mut self) -> Self {
|
pub fn with_numerals(mut self, numerals_font: Font) -> Self {
|
||||||
self.show_numerals = true;
|
self.numeral_font = Some(numerals_font);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_numeral_offset(mut self, offset: Offset) -> Self {
|
||||||
|
self.numeral_offset = offset;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,9 +632,9 @@ where
|
|||||||
self.render_icon(base + self.done_offset, self.icon_done, color, target)
|
self.render_icon(base + self.done_offset, self.icon_done, color, target)
|
||||||
} else {
|
} else {
|
||||||
// current and future tasks - ordinal numbers or icon on current task
|
// current and future tasks - ordinal numbers or icon on current task
|
||||||
if self.show_numerals {
|
if let Some(font) = self.numeral_font {
|
||||||
let num_offset = Offset::new(4, FONT_NORMAL.visible_text_height("1"));
|
let offset = self.numeral_offset;
|
||||||
self.render_numeral(base + num_offset, i, l.style.text_color, target);
|
self.render_numeral(base + offset, i, font, l.style.text_color, target);
|
||||||
} else if i == current_visible {
|
} else if i == current_visible {
|
||||||
let color = l.style.text_color;
|
let color = l.style.text_color;
|
||||||
self.render_icon(base + self.current_offset, self.icon_current, color, target);
|
self.render_icon(base + self.current_offset, self.icon_current, color, target);
|
||||||
@ -643,12 +647,12 @@ where
|
|||||||
&self,
|
&self,
|
||||||
base_point: Point,
|
base_point: Point,
|
||||||
n: usize,
|
n: usize,
|
||||||
|
font: Font,
|
||||||
color: Color,
|
color: Color,
|
||||||
target: &mut impl Renderer<'s>,
|
target: &mut impl Renderer<'s>,
|
||||||
) {
|
) {
|
||||||
let numeral = uformat!("{}.", n + 1);
|
let numeral = uformat!("{}.", n + 1);
|
||||||
shape::Text::new(base_point, numeral.as_str())
|
shape::Text::new(base_point, numeral.as_str(), font)
|
||||||
.with_font(FONT_SUB)
|
|
||||||
.with_fg(color)
|
.with_fg(color)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@ use crate::ui::{
|
|||||||
shape::{Bitmap, BitmapFormat},
|
shape::{Bitmap, BitmapFormat},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use super::super::fonts::*;
|
|
||||||
|
|
||||||
#[cfg(feature = "translations")]
|
#[cfg(feature = "translations")]
|
||||||
use crate::translations::flash;
|
use crate::translations::flash;
|
||||||
#[cfg(feature = "translations")]
|
#[cfg(feature = "translations")]
|
||||||
|
@ -4,7 +4,7 @@ use crate::{
|
|||||||
trezorhal::secbool::secbool,
|
trezorhal::secbool::secbool,
|
||||||
ui::{
|
ui::{
|
||||||
component::{connect::Connect, Label},
|
component::{connect::Connect, Label},
|
||||||
display::{self, font, Color, Icon},
|
display::{self, Color, Icon},
|
||||||
geometry::{Point, Rect},
|
geometry::{Point, Rect},
|
||||||
layout::simplified::{run, show},
|
layout::simplified::{run, show},
|
||||||
},
|
},
|
||||||
@ -16,8 +16,9 @@ use super::{
|
|||||||
bl_confirm::{Confirm, ConfirmTitle},
|
bl_confirm::{Confirm, ConfirmTitle},
|
||||||
Button, ResultScreen, WelcomeScreen,
|
Button, ResultScreen, WelcomeScreen,
|
||||||
},
|
},
|
||||||
theme,
|
fonts,
|
||||||
theme::{
|
theme::{
|
||||||
|
self,
|
||||||
bootloader::{
|
bootloader::{
|
||||||
button_bld, button_bld_menu, button_confirm, button_wipe_cancel, button_wipe_confirm,
|
button_bld, button_bld_menu, button_confirm, button_wipe_cancel, button_wipe_confirm,
|
||||||
BLD_BG, BLD_FG, BLD_TITLE_COLOR, BLD_WIPE_COLOR, CHECK24, CHECK40, DOWNLOAD32, FIRE32,
|
BLD_BG, BLD_FG, BLD_TITLE_COLOR, BLD_WIPE_COLOR, CHECK24, CHECK40, DOWNLOAD32, FIRE32,
|
||||||
@ -73,11 +74,14 @@ impl UIBolt {
|
|||||||
display::sync();
|
display::sync();
|
||||||
|
|
||||||
render_on_display(None, Some(bg_color), |target| {
|
render_on_display(None, Some(bg_color), |target| {
|
||||||
shape::Text::new(Point::new(SCREEN.width() / 2, SCREEN.height() - 45), text)
|
shape::Text::new(
|
||||||
.with_align(Alignment::Center)
|
Point::new(SCREEN.width() / 2, SCREEN.height() - 45),
|
||||||
.with_font(font::FONT_NORMAL)
|
text,
|
||||||
.with_fg(fg_color)
|
fonts::FONT_NORMAL,
|
||||||
.render(target);
|
)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.with_fg(fg_color)
|
||||||
|
.render(target);
|
||||||
|
|
||||||
let center = SCREEN.center() + Offset::y(-20);
|
let center = SCREEN.center() + Offset::y(-20);
|
||||||
let inactive_color = bg_color.blend(fg_color, 85);
|
let inactive_color = bg_color.blend(fg_color, 85);
|
||||||
@ -319,7 +323,12 @@ impl BootloaderUI for UIBolt {
|
|||||||
|
|
||||||
fn screen_connect(initial_setup: bool) {
|
fn screen_connect(initial_setup: bool) {
|
||||||
let bg = if initial_setup { WELCOME_COLOR } else { BLD_BG };
|
let bg = if initial_setup { WELCOME_COLOR } else { BLD_BG };
|
||||||
let mut frame = Connect::new("Waiting for host...", BLD_TITLE_COLOR, bg);
|
let mut frame = Connect::new(
|
||||||
|
"Waiting for host...",
|
||||||
|
fonts::FONT_NORMAL,
|
||||||
|
BLD_TITLE_COLOR,
|
||||||
|
bg,
|
||||||
|
);
|
||||||
show(&mut frame, true);
|
show(&mut frame, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,9 +392,8 @@ impl BootloaderUI for UIBolt {
|
|||||||
// Draw vendor string if present
|
// Draw vendor string if present
|
||||||
if let Some(text) = vendor_str {
|
if let Some(text) = vendor_str {
|
||||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5 - 50);
|
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5 - 50);
|
||||||
shape::Text::new(pos, text)
|
shape::Text::new(pos, text, fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG) //COLOR_BL_BG
|
.with_fg(BLD_FG) //COLOR_BL_BG
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
@ -400,9 +408,8 @@ impl BootloaderUI for UIBolt {
|
|||||||
version[2]
|
version[2]
|
||||||
));
|
));
|
||||||
|
|
||||||
shape::Text::new(pos, version_text.as_str())
|
shape::Text::new(pos, version_text.as_str(), fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
@ -415,17 +422,15 @@ impl BootloaderUI for UIBolt {
|
|||||||
unwrap!(uwrite!(text, "starting in {} s", wait));
|
unwrap!(uwrite!(text, "starting in {} s", wait));
|
||||||
|
|
||||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||||
shape::Text::new(pos, text.as_str())
|
shape::Text::new(pos, text.as_str(), fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
core::cmp::Ordering::Less => {
|
core::cmp::Ordering::Less => {
|
||||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||||
shape::Text::new(pos, "click to continue ...")
|
shape::Text::new(pos, "click to continue ...", fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Pad},
|
component::{Component, Event, EventCtx, Never, Pad},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::{font, toif::Toif},
|
display::toif::Toif,
|
||||||
geometry::{Alignment, Alignment2D, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Offset, Rect},
|
||||||
shape,
|
shape::{self, Renderer},
|
||||||
shape::Renderer,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::theme::{
|
use super::super::{
|
||||||
bootloader::{START_URL, WELCOME_COLOR},
|
fonts,
|
||||||
GREY_MEDIUM, WHITE,
|
theme::{
|
||||||
|
bootloader::{START_URL, WELCOME_COLOR},
|
||||||
|
GREY_MEDIUM, WHITE,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Welcome {
|
pub struct Welcome {
|
||||||
@ -39,17 +41,23 @@ impl Component for Welcome {
|
|||||||
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
self.bg.render(target);
|
self.bg.render(target);
|
||||||
|
|
||||||
shape::Text::new(screen().top_center() + Offset::y(102), "Get started with")
|
shape::Text::new(
|
||||||
.with_align(Alignment::Center)
|
screen().top_center() + Offset::y(102),
|
||||||
.with_font(font::FONT_NORMAL)
|
"Get started with",
|
||||||
.with_fg(GREY_MEDIUM)
|
fonts::FONT_NORMAL,
|
||||||
.render(target);
|
)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.with_fg(GREY_MEDIUM)
|
||||||
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(screen().top_center() + Offset::y(126), "your Trezor at")
|
shape::Text::new(
|
||||||
.with_align(Alignment::Center)
|
screen().top_center() + Offset::y(126),
|
||||||
.with_font(font::FONT_NORMAL)
|
"your Trezor at",
|
||||||
.with_fg(GREY_MEDIUM)
|
fonts::FONT_NORMAL,
|
||||||
.render(target);
|
)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.with_fg(GREY_MEDIUM)
|
||||||
|
.render(target);
|
||||||
|
|
||||||
let icon = unwrap!(Toif::new(START_URL));
|
let icon = unwrap!(Toif::new(START_URL));
|
||||||
shape::ToifImage::new(screen().top_center() + Offset::y(135), icon)
|
shape::ToifImage::new(screen().top_center() + Offset::y(135), icon)
|
||||||
|
@ -186,8 +186,7 @@ impl Button {
|
|||||||
+ Offset::new(-width / 2, height / 2)
|
+ Offset::new(-width / 2, height / 2)
|
||||||
+ Offset::y(Self::BASELINE_OFFSET);
|
+ Offset::y(Self::BASELINE_OFFSET);
|
||||||
text.map(|text| {
|
text.map(|text| {
|
||||||
shape::Text::new(start_of_baseline, text)
|
shape::Text::new(start_of_baseline, text, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
@ -548,8 +547,7 @@ impl IconText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if use_text {
|
if use_text {
|
||||||
shape::Text::new(text_pos, self.text)
|
shape::Text::new(text_pos, self.text, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{text::TextStyle, Component, Event, EventCtx, Pad, Timer},
|
component::{text::TextStyle, Component, Event, EventCtx, Pad, Timer},
|
||||||
display::{
|
display::{
|
||||||
font,
|
|
||||||
image::{ImageInfo, ToifFormat},
|
image::{ImageInfo, ToifFormat},
|
||||||
toif::Icon,
|
toif::Icon,
|
||||||
Color,
|
Color,
|
||||||
@ -22,7 +21,7 @@ use crate::{
|
|||||||
use crate::ui::constant::{HEIGHT, WIDTH};
|
use crate::ui::constant::{HEIGHT, WIDTH};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
super::{constant, theme::IMAGE_HOMESCREEN},
|
super::{constant, fonts, theme::IMAGE_HOMESCREEN},
|
||||||
theme, Loader, LoaderMsg,
|
theme, Loader, LoaderMsg,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,9 +119,8 @@ impl Homescreen {
|
|||||||
|
|
||||||
fn render_loader<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render_loader<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
TR::progress__locking_device.map_translated(|t| {
|
TR::progress__locking_device.map_translated(|t| {
|
||||||
shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t)
|
shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t, fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(theme::FG);
|
.with_fg(theme::FG);
|
||||||
});
|
});
|
||||||
self.loader.render(target)
|
self.loader.render(target)
|
||||||
@ -233,9 +231,8 @@ impl Component for Homescreen {
|
|||||||
|
|
||||||
let style = theme::TEXT_DEMIBOLD;
|
let style = theme::TEXT_DEMIBOLD;
|
||||||
let pos = Point::new(self.pad.area.center().x, LABEL_Y);
|
let pos = Point::new(self.pad.area.center().x, LABEL_Y);
|
||||||
shape::Text::new(pos, t)
|
shape::Text::new(pos, t, style.text_font)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(style.text_font)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
@ -267,8 +264,7 @@ impl Component for Homescreen {
|
|||||||
style.text_font.vert_center(banner.y0, banner.y1, "A"),
|
style.text_font.vert_center(banner.y0, banner.y1, "A"),
|
||||||
);
|
);
|
||||||
|
|
||||||
shape::Text::new(text_pos, t)
|
shape::Text::new(text_pos, t, style.text_font)
|
||||||
.with_font(style.text_font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
@ -401,8 +397,7 @@ impl Component for Lockscreen<'_> {
|
|||||||
0,
|
0,
|
||||||
) + item.offset;
|
) + item.offset;
|
||||||
|
|
||||||
shape::Text::new(text_pos, t)
|
shape::Text::new(text_pos, t, item.style.text_font)
|
||||||
.with_font(item.style.text_font)
|
|
||||||
.with_fg(item.style.text_color)
|
.with_fg(item.style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
|
@ -113,8 +113,7 @@ impl Component for Bip39Input {
|
|||||||
// Content starts in the left-center point, offset by 16px to the right and 8px
|
// Content starts in the left-center point, offset by 16px to the right and 8px
|
||||||
// to the bottom.
|
// to the bottom.
|
||||||
let text_baseline = area.top_left().center(area.bottom_left()) + Offset::new(16, 8);
|
let text_baseline = area.top_left().center(area.bottom_left()) + Offset::new(16, 8);
|
||||||
shape::Text::new(text_baseline, text)
|
shape::Text::new(text_baseline, text, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
@ -122,8 +121,7 @@ impl Component for Bip39Input {
|
|||||||
if let Some(word) = self.suggested_word.and_then(|w| w.get(text.len()..)) {
|
if let Some(word) = self.suggested_word.and_then(|w| w.get(text.len()..)) {
|
||||||
let word_baseline = text_baseline + Offset::new(width, 0);
|
let word_baseline = text_baseline + Offset::new(width, 0);
|
||||||
let style = self.button_suggestion.style();
|
let style = self.button_suggestion.style();
|
||||||
shape::Text::new(word_baseline, word)
|
shape::Text::new(word_baseline, word, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -355,8 +355,7 @@ impl Component for Input {
|
|||||||
let text_to_display =
|
let text_to_display =
|
||||||
long_line_content_with_ellipsis(text, "...", style.text_font, available_area_width);
|
long_line_content_with_ellipsis(text, "...", style.text_font, available_area_width);
|
||||||
|
|
||||||
shape::Text::new(text_baseline, &text_to_display)
|
shape::Text::new(text_baseline, &text_to_display, style.text_font)
|
||||||
.with_font(style.text_font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ use crate::{
|
|||||||
base::ComponentExt, text::TextStyle, Child, Component, Event, EventCtx, Label, Maybe,
|
base::ComponentExt, text::TextStyle, Child, Component, Event, EventCtx, Label, Maybe,
|
||||||
Never, Pad, Timer,
|
Never, Pad, Timer,
|
||||||
},
|
},
|
||||||
display::font,
|
|
||||||
event::TouchEvent,
|
event::TouchEvent,
|
||||||
geometry::{Alignment, Alignment2D, Grid, Insets, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Grid, Insets, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
@ -17,6 +16,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
|
super::fonts,
|
||||||
button::{
|
button::{
|
||||||
Button, ButtonContent,
|
Button, ButtonContent,
|
||||||
ButtonMsg::{self, Clicked},
|
ButtonMsg::{self, Clicked},
|
||||||
@ -363,22 +363,20 @@ impl PinDots {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render_digits<'s>(&self, area: Rect, target: &mut impl Renderer<'s>) {
|
fn render_digits<'s>(&self, area: Rect, target: &mut impl Renderer<'s>) {
|
||||||
let center = area.center() + Offset::y(font::FONT_MONO.text_height() / 2);
|
let center = area.center() + Offset::y(fonts::FONT_MONO.text_height() / 2);
|
||||||
let right =
|
let right =
|
||||||
center + Offset::x(font::FONT_MONO.text_width("0") * (MAX_VISIBLE_DOTS as i16) / 2);
|
center + Offset::x(fonts::FONT_MONO.text_width("0") * (MAX_VISIBLE_DOTS as i16) / 2);
|
||||||
let digits = self.digits.len();
|
let digits = self.digits.len();
|
||||||
|
|
||||||
if digits <= MAX_VISIBLE_DOTS {
|
if digits <= MAX_VISIBLE_DOTS {
|
||||||
shape::Text::new(center, &self.digits)
|
shape::Text::new(center, &self.digits, fonts::FONT_MONO)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_MONO)
|
|
||||||
.with_fg(self.style.text_color)
|
.with_fg(self.style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
} else {
|
} else {
|
||||||
let offset: usize = digits.saturating_sub(MAX_VISIBLE_DIGITS);
|
let offset: usize = digits.saturating_sub(MAX_VISIBLE_DIGITS);
|
||||||
shape::Text::new(right, &self.digits[offset..])
|
shape::Text::new(right, &self.digits[offset..], fonts::FONT_MONO)
|
||||||
.with_align(Alignment::End)
|
.with_align(Alignment::End)
|
||||||
.with_font(font::FONT_MONO)
|
|
||||||
.with_fg(self.style.text_color)
|
.with_fg(self.style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
@ -422,11 +420,10 @@ impl PinDots {
|
|||||||
}
|
}
|
||||||
if last_digit && digits > 0 {
|
if last_digit && digits > 0 {
|
||||||
let last = &self.digits[(digits - 1)..digits];
|
let last = &self.digits[(digits - 1)..digits];
|
||||||
cursor.y = area.center().y + (font::FONT_MONO.text_height() / 2);
|
cursor.y = area.center().y + (fonts::FONT_MONO.text_height() / 2);
|
||||||
let offset = Offset::x(Self::DOT / 2);
|
let offset = Offset::x(Self::DOT / 2);
|
||||||
shape::Text::new(cursor + offset, last)
|
shape::Text::new(cursor + offset, last, fonts::FONT_MONO)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_MONO)
|
|
||||||
.with_fg(self.style.text_color)
|
.with_fg(self.style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
} else {
|
} else {
|
||||||
|
@ -156,8 +156,7 @@ impl Component for Slip39Input {
|
|||||||
.assert_if_debugging_ui("Text buffer is too small");
|
.assert_if_debugging_ui("Text buffer is too small");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shape::Text::new(text_baseline, text.as_str())
|
shape::Text::new(text_baseline, text.as_str(), style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
|
@ -9,13 +9,12 @@ use crate::{
|
|||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
Child, Component, Event, EventCtx, Pad,
|
Child, Component, Event, EventCtx, Pad,
|
||||||
},
|
},
|
||||||
display::font,
|
|
||||||
geometry::{Alignment, Grid, Insets, Offset, Rect},
|
geometry::{Alignment, Grid, Insets, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{theme, Button, ButtonMsg};
|
use super::{super::fonts, theme, Button, ButtonMsg};
|
||||||
|
|
||||||
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
||||||
pub enum NumberInputDialogMsg {
|
pub enum NumberInputDialogMsg {
|
||||||
@ -206,14 +205,13 @@ impl Component for NumberInput {
|
|||||||
let mut buf = [0u8; 10];
|
let mut buf = [0u8; 10];
|
||||||
|
|
||||||
if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) {
|
if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) {
|
||||||
let digit_font = font::FONT_DEMIBOLD;
|
let digit_font = fonts::FONT_DEMIBOLD;
|
||||||
let y_offset = digit_font.text_height() / 2 + Button::BASELINE_OFFSET;
|
let y_offset = digit_font.text_height() / 2 + Button::BASELINE_OFFSET;
|
||||||
|
|
||||||
shape::Bar::new(self.area).with_bg(theme::BG).render(target);
|
shape::Bar::new(self.area).with_bg(theme::BG).render(target);
|
||||||
shape::Text::new(self.area.center() + Offset::y(y_offset), text)
|
shape::Text::new(self.area.center() + Offset::y(y_offset), text, digit_font)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.with_font(digit_font)
|
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,14 +13,14 @@ use crate::{
|
|||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
Child, Component, Event, EventCtx, Label, Never, Pad,
|
Child, Component, Event, EventCtx, Label, Never, Pad,
|
||||||
},
|
},
|
||||||
display::{font, LOADER_MAX},
|
display::LOADER_MAX,
|
||||||
geometry::{Insets, Offset, Rect},
|
geometry::{Insets, Offset, Rect},
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
util::animation_disabled,
|
util::animation_disabled,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::constant;
|
use super::super::{constant, fonts};
|
||||||
|
|
||||||
pub struct Progress {
|
pub struct Progress {
|
||||||
title: Child<Label<'static>>,
|
title: Child<Label<'static>>,
|
||||||
@ -65,7 +65,7 @@ impl Component for Progress {
|
|||||||
.map(|t| t.chars().filter(|c| *c == '\n').count() as i16);
|
.map(|t| t.chars().filter(|c| *c == '\n').count() as i16);
|
||||||
let (title, rest) = Self::AREA.split_top(self.title.inner().max_size().y);
|
let (title, rest) = Self::AREA.split_top(self.title.inner().max_size().y);
|
||||||
let (loader, description) =
|
let (loader, description) =
|
||||||
rest.split_bottom(font::FONT_NORMAL.line_height() * description_lines);
|
rest.split_bottom(fonts::FONT_NORMAL.line_height() * description_lines);
|
||||||
let loader = loader.inset(Insets::top(theme::CONTENT_BORDER));
|
let loader = loader.inset(Insets::top(theme::CONTENT_BORDER));
|
||||||
self.title.place(title);
|
self.title.place(title);
|
||||||
self.loader_y_offset = loader.center().y - constant::screen().center().y;
|
self.loader_y_offset = loader.center().y - constant::screen().center().y;
|
||||||
|
@ -3,7 +3,7 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{text::TextStyle, Child, Component, Event, EventCtx, Label, Never, Pad},
|
component::{text::TextStyle, Child, Component, Event, EventCtx, Label, Never, Pad},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::{font, Color, Icon},
|
display::{Color, Icon},
|
||||||
geometry::{Alignment2D, Insets, Offset, Point, Rect},
|
geometry::{Alignment2D, Insets, Offset, Point, Rect},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
@ -12,6 +12,7 @@ use crate::{
|
|||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
constant::WIDTH,
|
constant::WIDTH,
|
||||||
|
fonts,
|
||||||
theme::{FG, RESULT_FOOTER_START, RESULT_PADDING},
|
theme::{FG, RESULT_FOOTER_START, RESULT_PADDING},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -34,11 +35,11 @@ impl ResultStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const fn message_style(&self) -> TextStyle {
|
pub const fn message_style(&self) -> TextStyle {
|
||||||
TextStyle::new(font::FONT_NORMAL, self.fg_color, self.bg_color, FG, FG)
|
TextStyle::new(fonts::FONT_NORMAL, self.fg_color, self.bg_color, FG, FG)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn title_style(&self) -> TextStyle {
|
pub const fn title_style(&self) -> TextStyle {
|
||||||
TextStyle::new(font::FONT_BOLD_UPPER, self.fg_color, self.bg_color, FG, FG)
|
TextStyle::new(fonts::FONT_BOLD_UPPER, self.fg_color, self.bg_color, FG, FG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@ use crate::{
|
|||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Paginate},
|
component::{Component, Event, EventCtx, Never, Paginate},
|
||||||
display::{font, Font},
|
display::Font,
|
||||||
geometry::{Offset, Rect},
|
geometry::{Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::theme;
|
use super::super::{fonts, theme};
|
||||||
|
|
||||||
use heapless::Vec;
|
use heapless::Vec;
|
||||||
#[cfg(feature = "ui_debug")]
|
#[cfg(feature = "ui_debug")]
|
||||||
@ -16,7 +16,7 @@ use ufmt::uwrite;
|
|||||||
|
|
||||||
const WORDS_PER_PAGE: usize = 4;
|
const WORDS_PER_PAGE: usize = 4;
|
||||||
const TOP_PADDING_OFFSET: i16 = 13;
|
const TOP_PADDING_OFFSET: i16 = 13;
|
||||||
const WORD_FONT: Font = font::FONT_MONO;
|
const WORD_FONT: Font = fonts::FONT_MONO;
|
||||||
const MAX_WORDS: usize = 33; // super-shamir has 33 words, all other have less
|
const MAX_WORDS: usize = 33; // super-shamir has 33 words, all other have less
|
||||||
|
|
||||||
/// Showing the given share words.
|
/// Showing the given share words.
|
||||||
@ -75,8 +75,7 @@ impl<'a> Component for ShareWords<'a> {
|
|||||||
} else {
|
} else {
|
||||||
uformat!(" {}. {}", ordinal, w)
|
uformat!(" {}. {}", ordinal, w)
|
||||||
};
|
};
|
||||||
shape::Text::new(base, &text_fmt)
|
shape::Text::new(base, &text_fmt, WORD_FONT)
|
||||||
.with_font(WORD_FONT)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,8 @@ use crate::ui::{
|
|||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "bootloader"))]
|
||||||
|
use super::super::fonts;
|
||||||
use super::theme;
|
use super::theme;
|
||||||
#[cfg(feature = "bootloader")]
|
#[cfg(feature = "bootloader")]
|
||||||
use super::theme::bootloader::DEVICE_NAME;
|
use super::theme::bootloader::DEVICE_NAME;
|
||||||
@ -19,7 +21,7 @@ use crate::{
|
|||||||
ui::{display, geometry::Alignment},
|
ui::{display, geometry::Alignment},
|
||||||
};
|
};
|
||||||
#[cfg(not(feature = "bootloader"))]
|
#[cfg(not(feature = "bootloader"))]
|
||||||
const MODEL_NAME_FONT: display::Font = display::font::FONT_DEMIBOLD;
|
const MODEL_NAME_FONT: display::Font = fonts::FONT_DEMIBOLD;
|
||||||
|
|
||||||
pub struct WelcomeScreen {
|
pub struct WelcomeScreen {
|
||||||
area: Rect,
|
area: Rect,
|
||||||
@ -66,9 +68,9 @@ impl Component for WelcomeScreen {
|
|||||||
shape::Text::new(
|
shape::Text::new(
|
||||||
self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN),
|
self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN),
|
||||||
model::FULL_NAME,
|
model::FULL_NAME,
|
||||||
|
MODEL_NAME_FONT,
|
||||||
)
|
)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(MODEL_NAME_FONT)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{text::TextStyle, LineBreaking::BreakWordsNoHyphen},
|
component::{text::TextStyle, LineBreaking::BreakWordsNoHyphen},
|
||||||
constant::{HEIGHT, WIDTH},
|
constant::{HEIGHT, WIDTH},
|
||||||
display::{font, Color},
|
display::Color,
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
util::include_res,
|
util::include_res,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
component::{ButtonStyle, ButtonStyleSheet, ResultStyle},
|
component::{ButtonStyle, ButtonStyleSheet, ResultStyle},
|
||||||
|
fonts,
|
||||||
theme::{BLACK, FG, GREY_DARK, GREY_LIGHT, WHITE},
|
theme::{BLACK, FG, GREY_DARK, GREY_LIGHT, WHITE},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ pub const START_URL: &[u8] = include_res!("layout_bolt/res/start.toif");
|
|||||||
pub fn button_confirm() -> ButtonStyleSheet {
|
pub fn button_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_BG,
|
text_color: BLD_BG,
|
||||||
button_color: WHITE,
|
button_color: WHITE,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -85,7 +86,7 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_BG,
|
text_color: BLD_BG,
|
||||||
button_color: BLD_INSTALL_BTN_COLOR_ACTIVE,
|
button_color: BLD_INSTALL_BTN_COLOR_ACTIVE,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -94,7 +95,7 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: FG,
|
background_color: FG,
|
||||||
@ -108,7 +109,7 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
|||||||
pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: WHITE,
|
text_color: WHITE,
|
||||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR,
|
button_color: BLD_WIPE_CANCEL_BTN_COLOR,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
@ -117,7 +118,7 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: WHITE,
|
text_color: WHITE,
|
||||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR_ACTIVE,
|
button_color: BLD_WIPE_CANCEL_BTN_COLOR_ACTIVE,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
@ -126,7 +127,7 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: WHITE,
|
background_color: WHITE,
|
||||||
@ -140,7 +141,7 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
|||||||
pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_WIPE_COLOR,
|
text_color: BLD_WIPE_COLOR,
|
||||||
button_color: BLD_WIPE_BTN_COLOR,
|
button_color: BLD_WIPE_BTN_COLOR,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
@ -149,7 +150,7 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_WIPE_COLOR,
|
text_color: BLD_WIPE_COLOR,
|
||||||
button_color: BLD_WIPE_BTN_COLOR_ACTIVE,
|
button_color: BLD_WIPE_BTN_COLOR_ACTIVE,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
@ -158,7 +159,7 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: FG,
|
background_color: FG,
|
||||||
@ -172,7 +173,7 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
|||||||
pub fn button_bld_menu() -> ButtonStyleSheet {
|
pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BG,
|
button_color: BLD_BG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -181,7 +182,7 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
|||||||
border_width: 2,
|
border_width: 2,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BG,
|
button_color: BLD_BG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -190,7 +191,7 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
|||||||
border_width: 2,
|
border_width: 2,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BLD_BG,
|
button_color: BLD_BG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -204,7 +205,7 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
|||||||
pub fn button_bld() -> ButtonStyleSheet {
|
pub fn button_bld() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BTN_COLOR,
|
button_color: BLD_BTN_COLOR,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -213,7 +214,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BTN_COLOR_ACTIVE,
|
button_color: BLD_BTN_COLOR_ACTIVE,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -222,7 +223,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BLD_BTN_COLOR,
|
button_color: BLD_BTN_COLOR,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
@ -235,7 +236,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
|||||||
|
|
||||||
pub const fn text_title(bg: Color) -> TextStyle {
|
pub const fn text_title(bg: Color) -> TextStyle {
|
||||||
TextStyle::new(
|
TextStyle::new(
|
||||||
font::FONT_BOLD_UPPER,
|
fonts::FONT_BOLD_UPPER,
|
||||||
BLD_TITLE_COLOR,
|
BLD_TITLE_COLOR,
|
||||||
bg,
|
bg,
|
||||||
BLD_TITLE_COLOR,
|
BLD_TITLE_COLOR,
|
||||||
@ -244,29 +245,29 @@ pub const fn text_title(bg: Color) -> TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const TEXT_NORMAL: TextStyle =
|
pub const TEXT_NORMAL: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
TextStyle::new(fonts::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||||
pub const TEXT_WARNING: TextStyle = TextStyle::new(
|
pub const TEXT_WARNING: TextStyle = TextStyle::new(
|
||||||
font::FONT_BOLD_UPPER,
|
fonts::FONT_BOLD_UPPER,
|
||||||
BLD_WARN_COLOR,
|
BLD_WARN_COLOR,
|
||||||
BLD_BG,
|
BLD_BG,
|
||||||
BLD_WARN_COLOR,
|
BLD_WARN_COLOR,
|
||||||
BLD_WARN_COLOR,
|
BLD_WARN_COLOR,
|
||||||
);
|
);
|
||||||
pub const fn text_fingerprint(bg: Color) -> TextStyle {
|
pub const fn text_fingerprint(bg: Color) -> TextStyle {
|
||||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, bg, BLD_FG, BLD_FG)
|
TextStyle::new(fonts::FONT_NORMAL, BLD_FG, bg, BLD_FG, BLD_FG)
|
||||||
.with_line_breaking(BreakWordsNoHyphen)
|
.with_line_breaking(BreakWordsNoHyphen)
|
||||||
}
|
}
|
||||||
pub const TEXT_BOLD: TextStyle =
|
pub const TEXT_BOLD: TextStyle =
|
||||||
TextStyle::new(font::FONT_BOLD_UPPER, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
TextStyle::new(fonts::FONT_BOLD_UPPER, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||||
pub const TEXT_WIPE_BOLD: TextStyle = TextStyle::new(
|
pub const TEXT_WIPE_BOLD: TextStyle = TextStyle::new(
|
||||||
font::FONT_BOLD_UPPER,
|
fonts::FONT_BOLD_UPPER,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
BLD_WIPE_COLOR,
|
BLD_WIPE_COLOR,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
);
|
);
|
||||||
pub const TEXT_WIPE_NORMAL: TextStyle = TextStyle::new(
|
pub const TEXT_WIPE_NORMAL: TextStyle = TextStyle::new(
|
||||||
font::FONT_NORMAL,
|
fonts::FONT_NORMAL,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
BLD_WIPE_COLOR,
|
BLD_WIPE_COLOR,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
|
@ -8,13 +8,16 @@ use crate::{
|
|||||||
text::{layout::Chunks, LineBreaking, PageBreaking, TextStyle},
|
text::{layout::Chunks, LineBreaking, PageBreaking, TextStyle},
|
||||||
FixedHeightBar,
|
FixedHeightBar,
|
||||||
},
|
},
|
||||||
display::{font, Color},
|
display::Color,
|
||||||
geometry::{Insets, Offset},
|
geometry::{Insets, Offset},
|
||||||
util::{include_icon, include_res},
|
util::{include_icon, include_res},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::component::{ButtonStyle, ButtonStyleSheet, LoaderStyle, LoaderStyleSheet, ResultStyle};
|
use super::{
|
||||||
|
component::{ButtonStyle, ButtonStyleSheet, LoaderStyle, LoaderStyleSheet, ResultStyle},
|
||||||
|
fonts,
|
||||||
|
};
|
||||||
|
|
||||||
pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
||||||
|
|
||||||
@ -118,15 +121,15 @@ pub const fn label_default() -> TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard() -> TextStyle {
|
pub const fn label_keyboard() -> TextStyle {
|
||||||
TextStyle::new(font::FONT_DEMIBOLD, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(fonts::FONT_DEMIBOLD, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard_prompt() -> TextStyle {
|
pub const fn label_keyboard_prompt() -> TextStyle {
|
||||||
TextStyle::new(font::FONT_DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(fonts::FONT_DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard_warning() -> TextStyle {
|
pub const fn label_keyboard_warning() -> TextStyle {
|
||||||
TextStyle::new(font::FONT_DEMIBOLD, RED, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(fonts::FONT_DEMIBOLD, RED, BG, GREY_LIGHT, GREY_LIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard_minor() -> TextStyle {
|
pub const fn label_keyboard_minor() -> TextStyle {
|
||||||
@ -155,7 +158,7 @@ pub const fn label_progress() -> TextStyle {
|
|||||||
|
|
||||||
pub const fn label_title() -> TextStyle {
|
pub const fn label_title() -> TextStyle {
|
||||||
TextStyle::new(
|
TextStyle::new(
|
||||||
font::FONT_BOLD_UPPER,
|
fonts::FONT_BOLD_UPPER,
|
||||||
GREY_LIGHT,
|
GREY_LIGHT,
|
||||||
BG,
|
BG,
|
||||||
GREY_LIGHT,
|
GREY_LIGHT,
|
||||||
@ -164,17 +167,17 @@ pub const fn label_title() -> TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_subtitle() -> TextStyle {
|
pub const fn label_subtitle() -> TextStyle {
|
||||||
TextStyle::new(font::FONT_MONO, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(fonts::FONT_MONO, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_coinjoin_progress() -> TextStyle {
|
pub const fn label_coinjoin_progress() -> TextStyle {
|
||||||
TextStyle::new(font::FONT_BOLD_UPPER, FG, YELLOW, FG, FG)
|
TextStyle::new(fonts::FONT_BOLD_UPPER, FG, YELLOW, FG, FG)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn button_default() -> ButtonStyleSheet {
|
pub const fn button_default() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -183,7 +186,7 @@ pub const fn button_default() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_MEDIUM,
|
button_color: GREY_MEDIUM,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -192,7 +195,7 @@ pub const fn button_default() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -206,7 +209,7 @@ pub const fn button_default() -> ButtonStyleSheet {
|
|||||||
pub const fn button_confirm() -> ButtonStyleSheet {
|
pub const fn button_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN,
|
button_color: GREEN,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -215,7 +218,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -224,7 +227,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -238,7 +241,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_cancel() -> ButtonStyleSheet {
|
pub const fn button_cancel() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: RED,
|
button_color: RED,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -247,7 +250,7 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: RED_DARK,
|
button_color: RED_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -256,7 +259,7 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: RED,
|
button_color: RED,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -274,7 +277,7 @@ pub const fn button_danger() -> ButtonStyleSheet {
|
|||||||
pub const fn button_reset() -> ButtonStyleSheet {
|
pub const fn button_reset() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: YELLOW,
|
button_color: YELLOW,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -283,7 +286,7 @@ pub const fn button_reset() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: YELLOW_DARK,
|
button_color: YELLOW_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -292,7 +295,7 @@ pub const fn button_reset() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: YELLOW,
|
button_color: YELLOW,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -306,7 +309,7 @@ pub const fn button_reset() -> ButtonStyleSheet {
|
|||||||
pub const fn button_moreinfo() -> ButtonStyleSheet {
|
pub const fn button_moreinfo() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -315,7 +318,7 @@ pub const fn button_moreinfo() -> ButtonStyleSheet {
|
|||||||
border_width: 2,
|
border_width: 2,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -324,7 +327,7 @@ pub const fn button_moreinfo() -> ButtonStyleSheet {
|
|||||||
border_width: 2,
|
border_width: 2,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -338,7 +341,7 @@ pub const fn button_moreinfo() -> ButtonStyleSheet {
|
|||||||
pub const fn button_info() -> ButtonStyleSheet {
|
pub const fn button_info() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BLUE,
|
button_color: BLUE,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -347,7 +350,7 @@ pub const fn button_info() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BLUE_DARK,
|
button_color: BLUE_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -356,7 +359,7 @@ pub const fn button_info() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD_UPPER,
|
font: fonts::FONT_BOLD_UPPER,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BLUE,
|
button_color: BLUE,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -370,7 +373,7 @@ pub const fn button_info() -> ButtonStyleSheet {
|
|||||||
pub const fn button_pin() -> ButtonStyleSheet {
|
pub const fn button_pin() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -379,7 +382,7 @@ pub const fn button_pin() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_MEDIUM,
|
button_color: GREY_MEDIUM,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -388,7 +391,7 @@ pub const fn button_pin() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG, // so there is no "button" itself, just the text
|
button_color: BG, // so there is no "button" itself, just the text
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -402,7 +405,7 @@ pub const fn button_pin() -> ButtonStyleSheet {
|
|||||||
pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN,
|
button_color: GREEN,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -411,7 +414,7 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -420,7 +423,7 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -434,7 +437,7 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK, // same as PIN buttons
|
button_color: GREY_DARK, // same as PIN buttons
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -443,7 +446,7 @@ pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -452,7 +455,7 @@ pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -466,7 +469,7 @@ pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
|||||||
pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREEN_DARK,
|
text_color: GREEN_DARK,
|
||||||
button_color: GREEN,
|
button_color: GREEN,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -475,7 +478,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -484,7 +487,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -498,7 +501,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_DARK, // same as PIN buttons
|
button_color: GREY_DARK, // same as PIN buttons
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -507,7 +510,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -516,7 +519,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -530,7 +533,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
|||||||
pub const fn button_counter() -> ButtonStyleSheet {
|
pub const fn button_counter() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -539,7 +542,7 @@ pub const fn button_counter() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_MEDIUM,
|
button_color: GREY_MEDIUM,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -548,7 +551,7 @@ pub const fn button_counter() -> ButtonStyleSheet {
|
|||||||
border_width: 0,
|
border_width: 0,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
@ -594,12 +597,12 @@ pub const fn loader_lock_icon() -> LoaderStyleSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const TEXT_NORMAL: TextStyle =
|
pub const TEXT_NORMAL: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_DEMIBOLD: TextStyle =
|
pub const TEXT_DEMIBOLD: TextStyle =
|
||||||
TextStyle::new(font::FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_BOLD: TextStyle =
|
pub const TEXT_BOLD: TextStyle =
|
||||||
TextStyle::new(font::FONT_BOLD_UPPER, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_BOLD_UPPER, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_MONO: TextStyle = TextStyle::new(font::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
|
pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
|
||||||
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
||||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
||||||
@ -630,13 +633,13 @@ pub fn get_chunkified_text_style(character_length: usize) -> &'static TextStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const TEXT_NORMAL_OFF_WHITE: TextStyle =
|
pub const TEXT_NORMAL_OFF_WHITE: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_NORMAL, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_CHECKLIST_DEFAULT: TextStyle =
|
pub const TEXT_CHECKLIST_DEFAULT: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_NORMAL, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_CHECKLIST_SELECTED: TextStyle =
|
pub const TEXT_CHECKLIST_SELECTED: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_CHECKLIST_DONE: TextStyle =
|
pub const TEXT_CHECKLIST_DONE: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, GREEN_DARK, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_NORMAL, GREEN_DARK, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
|
|
||||||
pub const CONTENT_BORDER: i16 = 0;
|
pub const CONTENT_BORDER: i16 = 0;
|
||||||
pub const BUTTON_HEIGHT: i16 = 50;
|
pub const BUTTON_HEIGHT: i16 = 50;
|
||||||
|
@ -40,7 +40,7 @@ use super::{
|
|||||||
PassphraseKeyboard, PinKeyboard, Progress, SelectWordCount, SetBrightnessDialog,
|
PassphraseKeyboard, PinKeyboard, Progress, SelectWordCount, SetBrightnessDialog,
|
||||||
ShareWords, SimplePage, Slip39Input,
|
ShareWords, SimplePage, Slip39Input,
|
||||||
},
|
},
|
||||||
theme, UIBolt,
|
fonts, theme, UIBolt,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl FirmwareUI for UIBolt {
|
impl FirmwareUI for UIBolt {
|
||||||
@ -187,14 +187,14 @@ impl FirmwareUI for UIBolt {
|
|||||||
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
|
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
|
||||||
for item in IterBuf::new().try_iterate(items)? {
|
for item in IterBuf::new().try_iterate(items)? {
|
||||||
if item.is_str() {
|
if item.is_str() {
|
||||||
ops = ops.text_normal(TString::try_from(item)?)
|
ops = ops.text(TString::try_from(item)?, fonts::FONT_NORMAL)
|
||||||
} else {
|
} else {
|
||||||
let [emphasis, text]: [Obj; 2] = util::iter_into_array(item)?;
|
let [emphasis, text]: [Obj; 2] = util::iter_into_array(item)?;
|
||||||
let text: TString = text.try_into()?;
|
let text: TString = text.try_into()?;
|
||||||
if emphasis.try_into()? {
|
if emphasis.try_into()? {
|
||||||
ops = ops.text_demibold(text);
|
ops = ops.text(text, fonts::FONT_DEMIBOLD)
|
||||||
} else {
|
} else {
|
||||||
ops = ops.text_normal(text);
|
ops = ops.text(text, fonts::FONT_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1109,7 +1109,8 @@ impl FirmwareUI for UIBolt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
|
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
let layout = RootComponent::new(Connect::new(text, theme::FG, theme::BG));
|
let layout =
|
||||||
|
RootComponent::new(Connect::new(text, fonts::FONT_NORMAL, theme::FG, theme::BG));
|
||||||
Ok(layout)
|
Ok(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1335,8 +1336,11 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
||||||
.text_normal("Testing text layout, with some text, and some more text. And ")
|
.text(
|
||||||
.text_bold_upper("parameters!");
|
"Testing text layout, with some text, and some more text. And ",
|
||||||
|
fonts::FONT_NORMAL,
|
||||||
|
)
|
||||||
|
.text("parameters!", fonts::FONT_BOLD_UPPER);
|
||||||
let formatted = FormattedText::new(ops);
|
let formatted = FormattedText::new(ops);
|
||||||
let mut layout = Dialog::new(formatted, buttons);
|
let mut layout = Dialog::new(formatted, buttons);
|
||||||
layout.place(SCREEN);
|
layout.place(SCREEN);
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{Child, Component, Event, EventCtx, Pad},
|
component::{Child, Component, Event, EventCtx, Pad},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::{font, Icon},
|
display::Icon,
|
||||||
geometry::{Alignment, Alignment2D, Offset, Point, Rect},
|
geometry::{Alignment, Alignment2D, Offset, Point, Rect},
|
||||||
layout::simplified::ReturnToC,
|
layout::simplified::ReturnToC,
|
||||||
shape,
|
shape,
|
||||||
@ -15,6 +15,7 @@ use crate::{
|
|||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
component::{ButtonLayout, Choice, ChoiceFactory, ChoicePage},
|
component::{ButtonLayout, Choice, ChoiceFactory, ChoicePage},
|
||||||
|
fonts,
|
||||||
theme::bootloader::{BLD_BG, BLD_FG, ICON_EXIT, ICON_REDO, ICON_TRASH},
|
theme::bootloader::{BLD_BG, BLD_FG, ICON_EXIT, ICON_REDO, ICON_TRASH},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,17 +59,19 @@ impl Choice for MenuChoice {
|
|||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(SCREEN_CENTER, self.first_line)
|
shape::Text::new(SCREEN_CENTER, self.first_line, fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(SCREEN_CENTER + Offset::y(10), self.second_line)
|
shape::Text::new(
|
||||||
.with_align(Alignment::Center)
|
SCREEN_CENTER + Offset::y(10),
|
||||||
.with_font(font::FONT_NORMAL)
|
self.second_line,
|
||||||
.with_fg(BLD_FG)
|
fonts::FONT_NORMAL,
|
||||||
.render(target);
|
)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.with_fg(BLD_FG)
|
||||||
|
.render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn btn_layout(&self) -> ButtonLayout {
|
fn btn_layout(&self) -> ButtonLayout {
|
||||||
|
@ -6,7 +6,7 @@ use crate::{
|
|||||||
component::{connect::Connect, Label, LineBreaking::BreakWordsNoHyphen},
|
component::{connect::Connect, Label, LineBreaking::BreakWordsNoHyphen},
|
||||||
constant,
|
constant,
|
||||||
constant::{HEIGHT, SCREEN},
|
constant::{HEIGHT, SCREEN},
|
||||||
display::{self, font, Color, Icon},
|
display::{self, Color, Icon},
|
||||||
geometry::{Alignment2D, Offset, Point},
|
geometry::{Alignment2D, Offset, Point},
|
||||||
layout::simplified::{run, show, ReturnToC},
|
layout::simplified::{run, show, ReturnToC},
|
||||||
},
|
},
|
||||||
@ -17,7 +17,7 @@ use super::{
|
|||||||
bl_confirm::{Confirm, ConfirmMsg},
|
bl_confirm::{Confirm, ConfirmMsg},
|
||||||
ResultScreen, WelcomeScreen,
|
ResultScreen, WelcomeScreen,
|
||||||
},
|
},
|
||||||
cshape,
|
cshape, fonts,
|
||||||
theme::{
|
theme::{
|
||||||
bootloader::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, ICON_SUCCESS},
|
bootloader::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, ICON_SUCCESS},
|
||||||
ICON_ARM_LEFT, ICON_ARM_RIGHT, TEXT_BOLD, TEXT_NORMAL,
|
ICON_ARM_LEFT, ICON_ARM_RIGHT, TEXT_BOLD, TEXT_NORMAL,
|
||||||
@ -74,15 +74,13 @@ impl UICaesar {
|
|||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
shape::Text::new(SCREEN.center() + Offset::y(8), text)
|
shape::Text::new(SCREEN.center() + Offset::y(8), text, fonts::FONT_BOLD)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_BOLD)
|
|
||||||
.with_fg(fg_color)
|
.with_fg(fg_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(SCREEN.center() + Offset::y(20), text2)
|
shape::Text::new(SCREEN.center() + Offset::y(20), text2, fonts::FONT_BOLD)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_BOLD)
|
|
||||||
.with_fg(fg_color)
|
.with_fg(fg_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
@ -276,7 +274,7 @@ impl BootloaderUI for UICaesar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn screen_connect(_initial_setup: bool) {
|
fn screen_connect(_initial_setup: bool) {
|
||||||
let mut frame = Connect::new("Waiting for host...", BLD_FG, BLD_BG);
|
let mut frame = Connect::new("Waiting for host...", fonts::FONT_NORMAL, BLD_FG, BLD_BG);
|
||||||
show(&mut frame, false);
|
show(&mut frame, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,9 +322,8 @@ impl BootloaderUI for UICaesar {
|
|||||||
// Draw vendor string if present
|
// Draw vendor string if present
|
||||||
if let Some(text) = vendor_str {
|
if let Some(text) = vendor_str {
|
||||||
let pos = Point::new(constant::WIDTH / 2, 36);
|
let pos = Point::new(constant::WIDTH / 2, 36);
|
||||||
shape::Text::new(pos, text)
|
shape::Text::new(pos, text, fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG) //COLOR_BL_BG
|
.with_fg(BLD_FG) //COLOR_BL_BG
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
@ -341,9 +338,8 @@ impl BootloaderUI for UICaesar {
|
|||||||
version[2]
|
version[2]
|
||||||
));
|
));
|
||||||
|
|
||||||
shape::Text::new(pos, version_text.as_str())
|
shape::Text::new(pos, version_text.as_str(), fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
@ -356,15 +352,14 @@ impl BootloaderUI for UICaesar {
|
|||||||
unwrap!(uwrite!(text, "starting in {} s", wait));
|
unwrap!(uwrite!(text, "starting in {} s", wait));
|
||||||
|
|
||||||
let pos = Point::new(constant::WIDTH / 2, HEIGHT - 5);
|
let pos = Point::new(constant::WIDTH / 2, HEIGHT - 5);
|
||||||
shape::Text::new(pos, text.as_str())
|
shape::Text::new(pos, text.as_str(), fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
core::cmp::Ordering::Less => {
|
core::cmp::Ordering::Less => {
|
||||||
let pos = Point::new(constant::WIDTH / 2, HEIGHT - 2);
|
let pos = Point::new(constant::WIDTH / 2, HEIGHT - 2);
|
||||||
shape::Text::new(pos, "CONTINUE")
|
shape::Text::new(pos, "CONTINUE", fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Pad},
|
component::{Component, Event, EventCtx, Never, Pad},
|
||||||
display::font,
|
|
||||||
geometry::{Alignment, Offset, Rect},
|
geometry::{Alignment, Offset, Rect},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::theme::bootloader::{BLD_BG, BLD_FG};
|
use super::{
|
||||||
|
super::theme::bootloader::{BLD_BG, BLD_FG},
|
||||||
|
fonts,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct Welcome {
|
pub struct Welcome {
|
||||||
bg: Pad,
|
bg: Pad,
|
||||||
@ -37,22 +39,31 @@ impl Component for Welcome {
|
|||||||
|
|
||||||
let top_center = self.bg.area.top_center();
|
let top_center = self.bg.area.top_center();
|
||||||
|
|
||||||
shape::Text::new(top_center + Offset::y(24), "Get started with")
|
shape::Text::new(
|
||||||
.with_align(Alignment::Center)
|
top_center + Offset::y(24),
|
||||||
.with_font(font::FONT_NORMAL)
|
"Get started with",
|
||||||
.with_fg(BLD_FG)
|
fonts::FONT_NORMAL,
|
||||||
.render(target);
|
)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.with_fg(BLD_FG)
|
||||||
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(top_center + Offset::y(32), "your Trezor at")
|
shape::Text::new(
|
||||||
.with_align(Alignment::Center)
|
top_center + Offset::y(32),
|
||||||
.with_font(font::FONT_NORMAL)
|
"your Trezor at",
|
||||||
.with_fg(BLD_FG)
|
fonts::FONT_NORMAL,
|
||||||
.render(target);
|
)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.with_fg(BLD_FG)
|
||||||
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(top_center + Offset::y(48), "trezor.io/start")
|
shape::Text::new(
|
||||||
.with_align(Alignment::Center)
|
top_center + Offset::y(48),
|
||||||
.with_font(font::FONT_BOLD)
|
"trezor.io/start",
|
||||||
.with_fg(BLD_FG)
|
fonts::FONT_BOLD,
|
||||||
.render(target);
|
)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.with_fg(BLD_FG)
|
||||||
|
.render(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
component::{Child, Component, ComponentExt, Event, EventCtx, Label, Pad},
|
component::{Child, Component, ComponentExt, Event, EventCtx, Label, Pad},
|
||||||
display::{font, Color},
|
display::Color,
|
||||||
geometry::{Point, Rect},
|
geometry::{Point, Rect},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
@ -10,6 +10,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
super::fonts,
|
||||||
theme::{BUTTON_HEIGHT, TITLE_AREA_HEIGHT, WHITE},
|
theme::{BUTTON_HEIGHT, TITLE_AREA_HEIGHT, WHITE},
|
||||||
ButtonController, ButtonControllerMsg, ButtonLayout, ButtonPos,
|
ButtonController, ButtonControllerMsg, ButtonLayout, ButtonPos,
|
||||||
};
|
};
|
||||||
@ -200,8 +201,7 @@ impl Component for Confirm<'_> {
|
|||||||
|
|
||||||
let mut display_top_left = |text: TString| {
|
let mut display_top_left = |text: TString| {
|
||||||
text.map(|t| {
|
text.map(|t| {
|
||||||
shape::Text::new(Point::zero(), t)
|
shape::Text::new(Point::zero(), t, fonts::FONT_BOLD)
|
||||||
.with_font(font::FONT_BOLD)
|
|
||||||
.with_fg(WHITE)
|
.with_fg(WHITE)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,7 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Never},
|
component::{Component, Event, EventCtx, Never},
|
||||||
constant,
|
constant,
|
||||||
display::{font, Color, Font, Icon},
|
display::{Color, Font, Icon},
|
||||||
event::PhysicalButton,
|
event::PhysicalButton,
|
||||||
geometry::{Alignment2D, Offset, Point, Rect},
|
geometry::{Alignment2D, Offset, Point, Rect},
|
||||||
shape,
|
shape,
|
||||||
@ -12,7 +12,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{loader::DEFAULT_DURATION_MS, theme};
|
use super::{super::fonts, loader::DEFAULT_DURATION_MS, theme};
|
||||||
|
|
||||||
const HALF_SCREEN_BUTTON_WIDTH: i16 = constant::WIDTH / 2 - 1;
|
const HALF_SCREEN_BUTTON_WIDTH: i16 = constant::WIDTH / 2 - 1;
|
||||||
|
|
||||||
@ -232,8 +232,8 @@ impl Component for Button {
|
|||||||
shape::Text::new(
|
shape::Text::new(
|
||||||
self.get_text_baseline(style) - Offset::x(style.font.start_x_bearing(t)),
|
self.get_text_baseline(style) - Offset::x(style.font.start_x_bearing(t)),
|
||||||
t,
|
t,
|
||||||
|
style.font,
|
||||||
)
|
)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(fg_color)
|
.with_fg(fg_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
}),
|
}),
|
||||||
@ -367,7 +367,7 @@ impl ButtonDetails {
|
|||||||
pub fn text(text: TString<'static>) -> Self {
|
pub fn text(text: TString<'static>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
content: ButtonContent::Text(text),
|
content: ButtonContent::Text(text),
|
||||||
font: font::FONT_NORMAL_UPPER,
|
font: fonts::FONT_NORMAL_UPPER,
|
||||||
duration: None,
|
duration: None,
|
||||||
with_outline: true,
|
with_outline: true,
|
||||||
with_arms: false,
|
with_arms: false,
|
||||||
@ -381,7 +381,7 @@ impl ButtonDetails {
|
|||||||
pub fn icon(icon: Icon) -> Self {
|
pub fn icon(icon: Icon) -> Self {
|
||||||
Self {
|
Self {
|
||||||
content: ButtonContent::Icon(icon),
|
content: ButtonContent::Icon(icon),
|
||||||
font: font::FONT_NORMAL_UPPER,
|
font: fonts::FONT_NORMAL_UPPER,
|
||||||
duration: None,
|
duration: None,
|
||||||
with_outline: false,
|
with_outline: false,
|
||||||
with_arms: false,
|
with_arms: false,
|
||||||
@ -561,7 +561,7 @@ impl ButtonLayout {
|
|||||||
Some(
|
Some(
|
||||||
ButtonDetails::text("i".into())
|
ButtonDetails::text("i".into())
|
||||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||||
.with_font(font::FONT_NORMAL),
|
.with_font(fonts::FONT_NORMAL),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -574,7 +574,7 @@ impl ButtonLayout {
|
|||||||
Some(
|
Some(
|
||||||
ButtonDetails::text("i".into())
|
ButtonDetails::text("i".into())
|
||||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||||
.with_font(font::FONT_NORMAL),
|
.with_font(fonts::FONT_NORMAL),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -695,7 +695,7 @@ impl ButtonLayout {
|
|||||||
Some(
|
Some(
|
||||||
ButtonDetails::text("i".into())
|
ButtonDetails::text("i".into())
|
||||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||||
.with_font(font::FONT_NORMAL),
|
.with_font(fonts::FONT_NORMAL),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@ use crate::{
|
|||||||
strutil::ShortString,
|
strutil::ShortString,
|
||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Pad},
|
component::{Component, Event, EventCtx, Never, Pad},
|
||||||
display::{font, Font},
|
display::Font,
|
||||||
geometry::{Alignment, Point, Rect},
|
geometry::{Alignment, Point, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
util::long_line_content_with_ellipsis,
|
util::long_line_content_with_ellipsis,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::theme;
|
use super::{super::fonts, theme};
|
||||||
|
|
||||||
/// Component that allows for "allocating" a standalone line of text anywhere
|
/// Component that allows for "allocating" a standalone line of text anywhere
|
||||||
/// on the screen and updating it arbitrarily - without affecting the rest
|
/// on the screen and updating it arbitrarily - without affecting the rest
|
||||||
@ -43,11 +43,11 @@ impl ChangingTextLine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn center_mono(text: &str, max_len: usize) -> Self {
|
pub fn center_mono(text: &str, max_len: usize) -> Self {
|
||||||
Self::new(text, font::FONT_MONO, Alignment::Center, max_len)
|
Self::new(text, fonts::FONT_MONO, Alignment::Center, max_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn center_bold(text: &str, max_len: usize) -> Self {
|
pub fn center_bold(text: &str, max_len: usize) -> Self {
|
||||||
Self::new(text, font::FONT_BOLD_UPPER, Alignment::Center, max_len)
|
Self::new(text, fonts::FONT_BOLD_UPPER, Alignment::Center, max_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Not showing ellipsis at the beginning of longer texts.
|
/// Not showing ellipsis at the beginning of longer texts.
|
||||||
@ -110,24 +110,20 @@ impl ChangingTextLine {
|
|||||||
|
|
||||||
fn render_left<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render_left<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
let baseline = Point::new(self.pad.area.x0, self.y_baseline());
|
let baseline = Point::new(self.pad.area.x0, self.y_baseline());
|
||||||
shape::Text::new(baseline, self.text.as_ref())
|
shape::Text::new(baseline, self.text.as_ref(), self.font).render(target);
|
||||||
.with_font(self.font)
|
|
||||||
.render(target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_center<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render_center<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
let baseline = Point::new(self.pad.area.bottom_center().x, self.y_baseline());
|
let baseline = Point::new(self.pad.area.bottom_center().x, self.y_baseline());
|
||||||
shape::Text::new(baseline, self.text.as_ref())
|
shape::Text::new(baseline, self.text.as_ref(), self.font)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(self.font)
|
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_right<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render_right<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
let baseline = Point::new(self.pad.area.x1, self.y_baseline());
|
let baseline = Point::new(self.pad.area.x1, self.y_baseline());
|
||||||
shape::Text::new(baseline, self.text.as_ref())
|
shape::Text::new(baseline, self.text.as_ref(), self.font)
|
||||||
.with_align(Alignment::End)
|
.with_align(Alignment::End)
|
||||||
.with_font(self.font)
|
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,9 +141,7 @@ impl ChangingTextLine {
|
|||||||
let x_offset = if self.text.len() % 2 == 0 { 0 } else { 2 };
|
let x_offset = if self.text.len() % 2 == 0 { 0 } else { 2 };
|
||||||
|
|
||||||
let baseline = Point::new(self.pad.area.x0 + x_offset, self.y_baseline());
|
let baseline = Point::new(self.pad.area.x0 + x_offset, self.y_baseline());
|
||||||
shape::Text::new(baseline, &text_to_display)
|
shape::Text::new(baseline, &text_to_display, self.font).render(target);
|
||||||
.with_font(self.font)
|
|
||||||
.render(target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ use crate::{
|
|||||||
text::util::{text_multiline, text_multiline_bottom},
|
text::util::{text_multiline, text_multiline_bottom},
|
||||||
Component, Event, EventCtx,
|
Component, Event, EventCtx,
|
||||||
},
|
},
|
||||||
display::font,
|
|
||||||
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
@ -17,7 +16,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{cshape, theme};
|
use super::super::{cshape, fonts, theme};
|
||||||
|
|
||||||
const FOOTER_TEXT_MARGIN: i16 = 8;
|
const FOOTER_TEXT_MARGIN: i16 = 8;
|
||||||
const LOADER_OFFSET: i16 = -15;
|
const LOADER_OFFSET: i16 = -15;
|
||||||
@ -88,7 +87,7 @@ impl Component for CoinJoinProgress {
|
|||||||
target,
|
target,
|
||||||
self.area,
|
self.area,
|
||||||
TR::coinjoin__title_progress.into(),
|
TR::coinjoin__title_progress.into(),
|
||||||
font::FONT_BOLD,
|
fonts::FONT_BOLD,
|
||||||
theme::FG,
|
theme::FG,
|
||||||
theme::BG,
|
theme::BG,
|
||||||
Alignment::Center,
|
Alignment::Center,
|
||||||
@ -111,7 +110,7 @@ impl Component for CoinJoinProgress {
|
|||||||
target,
|
target,
|
||||||
self.area,
|
self.area,
|
||||||
TR::coinjoin__do_not_disconnect.into(),
|
TR::coinjoin__do_not_disconnect.into(),
|
||||||
font::FONT_BOLD,
|
fonts::FONT_BOLD,
|
||||||
theme::FG,
|
theme::FG,
|
||||||
theme::BG,
|
theme::BG,
|
||||||
Alignment::Center,
|
Alignment::Center,
|
||||||
@ -121,7 +120,7 @@ impl Component for CoinJoinProgress {
|
|||||||
target,
|
target,
|
||||||
rest.inset(Insets::bottom(FOOTER_TEXT_MARGIN)),
|
rest.inset(Insets::bottom(FOOTER_TEXT_MARGIN)),
|
||||||
self.text,
|
self.text,
|
||||||
font::FONT_NORMAL,
|
fonts::FONT_NORMAL,
|
||||||
theme::FG,
|
theme::FG,
|
||||||
theme::BG,
|
theme::BG,
|
||||||
Alignment::Center,
|
Alignment::Center,
|
||||||
|
@ -7,7 +7,6 @@ use crate::{
|
|||||||
component::{Child, Component, Event, EventCtx, Label},
|
component::{Child, Component, Event, EventCtx, Label},
|
||||||
constant::{HEIGHT, WIDTH},
|
constant::{HEIGHT, WIDTH},
|
||||||
display::{
|
display::{
|
||||||
font,
|
|
||||||
image::{ImageInfo, ToifFormat},
|
image::{ImageInfo, ToifFormat},
|
||||||
Font, Icon,
|
Font, Icon,
|
||||||
},
|
},
|
||||||
@ -19,8 +18,9 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
super::constant, theme, ButtonController, ButtonControllerMsg, ButtonLayout, ButtonPos,
|
super::{constant, fonts},
|
||||||
CancelConfirmMsg, LoaderMsg, ProgressLoader,
|
theme, ButtonController, ButtonControllerMsg, ButtonLayout, ButtonPos, CancelConfirmMsg,
|
||||||
|
LoaderMsg, ProgressLoader,
|
||||||
};
|
};
|
||||||
|
|
||||||
const AREA: Rect = constant::screen();
|
const AREA: Rect = constant::screen();
|
||||||
@ -33,7 +33,7 @@ const LOGO_ICON_TOP_MARGIN: i16 = 12;
|
|||||||
const LOCK_ICON_TOP_MARGIN: i16 = 12;
|
const LOCK_ICON_TOP_MARGIN: i16 = 12;
|
||||||
const NOTIFICATION_HEIGHT: i16 = 12;
|
const NOTIFICATION_HEIGHT: i16 = 12;
|
||||||
const LABEL_OUTSET: i16 = 3;
|
const LABEL_OUTSET: i16 = 3;
|
||||||
const NOTIFICATION_FONT: Font = font::FONT_NORMAL_UPPER;
|
const NOTIFICATION_FONT: Font = fonts::FONT_NORMAL_UPPER;
|
||||||
const NOTIFICATION_ICON: Icon = theme::ICON_WARNING;
|
const NOTIFICATION_ICON: Icon = theme::ICON_WARNING;
|
||||||
const COINJOIN_CORNER: Point = AREA.top_right().ofs(Offset::new(-2, 2));
|
const COINJOIN_CORNER: Point = AREA.top_right().ofs(Offset::new(-2, 2));
|
||||||
|
|
||||||
@ -114,9 +114,8 @@ impl Homescreen {
|
|||||||
|
|
||||||
// TODO: fill warning icons here as well?
|
// TODO: fill warning icons here as well?
|
||||||
TR::homescreen__title_no_usb_connection.map_translated(|t| {
|
TR::homescreen__title_no_usb_connection.map_translated(|t| {
|
||||||
shape::Text::new(baseline, t)
|
shape::Text::new(baseline, t, NOTIFICATION_FONT)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(NOTIFICATION_FONT)
|
|
||||||
.render(target)
|
.render(target)
|
||||||
});
|
});
|
||||||
} else if let Some((notification, _level)) = &self.notification {
|
} else if let Some((notification, _level)) = &self.notification {
|
||||||
@ -125,9 +124,8 @@ impl Homescreen {
|
|||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
notification.map(|c| {
|
notification.map(|c| {
|
||||||
shape::Text::new(baseline, c)
|
shape::Text::new(baseline, c, NOTIFICATION_FONT)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(NOTIFICATION_FONT)
|
|
||||||
.render(target)
|
.render(target)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -217,8 +217,7 @@ fn render_text_icon<'s>(
|
|||||||
// Possibly shifting the baseline left, when there is a text bearing.
|
// Possibly shifting the baseline left, when there is a text bearing.
|
||||||
// This is to center the text properly.
|
// This is to center the text properly.
|
||||||
baseline = baseline - Offset::x(font.start_x_bearing(text));
|
baseline = baseline - Offset::x(font.start_x_bearing(text));
|
||||||
shape::Text::new(baseline, text)
|
shape::Text::new(baseline, text, font)
|
||||||
.with_font(font)
|
|
||||||
.with_fg(fg_color)
|
.with_fg(fg_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
text::common::TextBox, Child, Component, ComponentExt, Event, EventCtx, Timer,
|
text::common::TextBox, Child, Component, ComponentExt, Event, EventCtx, Timer,
|
||||||
},
|
},
|
||||||
display::{font, Icon},
|
display::Icon,
|
||||||
geometry::Rect,
|
geometry::Rect,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
theme, ButtonDetails, ButtonLayout, CancelConfirmMsg, ChangingTextLine, ChoiceFactory,
|
super::fonts, theme, ButtonDetails, ButtonLayout, CancelConfirmMsg, ChangingTextLine,
|
||||||
ChoiceItem, ChoicePage,
|
ChoiceFactory, ChoiceItem, ChoicePage,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
@ -164,7 +164,7 @@ impl<'a> PinEntry<'a> {
|
|||||||
let mut pin_line = pin_line_content
|
let mut pin_line = pin_line_content
|
||||||
.map(|s| ChangingTextLine::center_bold(s, MAX_PIN_LENGTH).without_ellipsis());
|
.map(|s| ChangingTextLine::center_bold(s, MAX_PIN_LENGTH).without_ellipsis());
|
||||||
if show_subprompt {
|
if show_subprompt {
|
||||||
pin_line.update_font(font::FONT_NORMAL);
|
pin_line.update_font(fonts::FONT_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
@ -202,10 +202,10 @@ impl<'a> PinEntry<'a> {
|
|||||||
let s = ShortString::new();
|
let s = ShortString::new();
|
||||||
s.capacity() >= MAX_PIN_LENGTH
|
s.capacity() >= MAX_PIN_LENGTH
|
||||||
});
|
});
|
||||||
let mut used_font = font::FONT_BOLD;
|
let mut used_font = fonts::FONT_BOLD;
|
||||||
let pin_line_text = if self.is_empty() && !self.subprompt.is_empty() {
|
let pin_line_text = if self.is_empty() && !self.subprompt.is_empty() {
|
||||||
// Showing the subprompt in NORMAL font
|
// Showing the subprompt in NORMAL font
|
||||||
used_font = font::FONT_NORMAL;
|
used_font = fonts::FONT_NORMAL;
|
||||||
self.subprompt.map(|s| unwrap!(ShortString::try_from(s)))
|
self.subprompt.map(|s| unwrap!(ShortString::try_from(s)))
|
||||||
} else if self.is_empty() {
|
} else if self.is_empty() {
|
||||||
unwrap!(ShortString::try_from(EMPTY_PIN_STR))
|
unwrap!(ShortString::try_from(EMPTY_PIN_STR))
|
||||||
|
@ -197,8 +197,7 @@ impl Loader {
|
|||||||
style.font.horz_center(self.area.x0, self.area.x1, t),
|
style.font.horz_center(self.area.x0, self.area.x1, t),
|
||||||
style.font.vert_center(self.area.y0, self.area.y1, "A"),
|
style.font.vert_center(self.area.y0, self.area.y1, "A"),
|
||||||
);
|
);
|
||||||
shape::Text::new(pt, t)
|
shape::Text::new(pt, t, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(text_color)
|
.with_fg(text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@ use crate::{
|
|||||||
Child, Component, Event, EventCtx, Label, Never, Pad,
|
Child, Component, Event, EventCtx, Label, Never, Pad,
|
||||||
},
|
},
|
||||||
constant,
|
constant,
|
||||||
display::{font, Icon, LOADER_MAX},
|
display::{Icon, LOADER_MAX},
|
||||||
geometry::{Alignment2D, Offset, Rect},
|
geometry::{Alignment2D, Offset, Rect},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
@ -17,7 +17,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{cshape, theme};
|
use super::super::{cshape, fonts, theme};
|
||||||
|
|
||||||
const BOTTOM_DESCRIPTION_MARGIN: i16 = 10;
|
const BOTTOM_DESCRIPTION_MARGIN: i16 = 10;
|
||||||
const LOADER_Y_OFFSET_TITLE: i16 = -10;
|
const LOADER_Y_OFFSET_TITLE: i16 = -10;
|
||||||
@ -99,7 +99,7 @@ impl Component for Progress {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let (_loader, description) = rest.split_bottom(
|
let (_loader, description) = rest.split_bottom(
|
||||||
BOTTOM_DESCRIPTION_MARGIN + font::FONT_NORMAL.line_height() * description_lines,
|
BOTTOM_DESCRIPTION_MARGIN + fonts::FONT_NORMAL.line_height() * description_lines,
|
||||||
);
|
);
|
||||||
self.title.place(title);
|
self.title.place(title);
|
||||||
self.loader_y_offset = loader_y_offset;
|
self.loader_y_offset = loader_y_offset;
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
text::util::text_multiline, Child, Component, Event, EventCtx, Never, Paginate,
|
text::util::text_multiline, Child, Component, Event, EventCtx, Never, Paginate,
|
||||||
},
|
},
|
||||||
display::{font, Font},
|
display::Font,
|
||||||
geometry::{Alignment, Offset, Rect},
|
geometry::{Alignment, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
@ -15,14 +15,14 @@ use heapless::Vec;
|
|||||||
#[cfg(feature = "ui_debug")]
|
#[cfg(feature = "ui_debug")]
|
||||||
use ufmt::uwrite;
|
use ufmt::uwrite;
|
||||||
|
|
||||||
use super::{scrollbar::SCROLLBAR_SPACE, theme, ScrollBar};
|
use super::{super::fonts, scrollbar::SCROLLBAR_SPACE, theme, ScrollBar};
|
||||||
|
|
||||||
const WORDS_PER_PAGE: usize = 3;
|
const WORDS_PER_PAGE: usize = 3;
|
||||||
const EXTRA_LINE_HEIGHT: i16 = -2;
|
const EXTRA_LINE_HEIGHT: i16 = -2;
|
||||||
const NUMBER_X_OFFSET: i16 = 0;
|
const NUMBER_X_OFFSET: i16 = 0;
|
||||||
const WORD_X_OFFSET: i16 = 25;
|
const WORD_X_OFFSET: i16 = 25;
|
||||||
const NUMBER_FONT: Font = font::FONT_DEMIBOLD;
|
const NUMBER_FONT: Font = fonts::FONT_DEMIBOLD;
|
||||||
const WORD_FONT: Font = font::FONT_BIG;
|
const WORD_FONT: Font = fonts::FONT_BIG;
|
||||||
const INFO_TOP_OFFSET: i16 = 20;
|
const INFO_TOP_OFFSET: i16 = 20;
|
||||||
const MAX_WORDS: usize = 33; // super-shamir has 33 words, all other have less
|
const MAX_WORDS: usize = 33; // super-shamir has 33 words, all other have less
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ impl<'a> ShareWords<'a> {
|
|||||||
target,
|
target,
|
||||||
self.area.split_top(INFO_TOP_OFFSET).1,
|
self.area.split_top(INFO_TOP_OFFSET).1,
|
||||||
final_text.as_str().into(),
|
final_text.as_str().into(),
|
||||||
font::FONT_NORMAL,
|
fonts::FONT_NORMAL,
|
||||||
theme::FG,
|
theme::FG,
|
||||||
theme::BG,
|
theme::BG,
|
||||||
Alignment::Start,
|
Alignment::Start,
|
||||||
@ -104,13 +104,11 @@ impl<'a> ShareWords<'a> {
|
|||||||
let base = self.area.top_left() + Offset::y(y_offset);
|
let base = self.area.top_left() + Offset::y(y_offset);
|
||||||
|
|
||||||
let ordinal_txt = uformat!("{}.", ordinal);
|
let ordinal_txt = uformat!("{}.", ordinal);
|
||||||
shape::Text::new(base + Offset::x(NUMBER_X_OFFSET), &ordinal_txt)
|
shape::Text::new(base + Offset::x(NUMBER_X_OFFSET), &ordinal_txt, NUMBER_FONT)
|
||||||
.with_font(NUMBER_FONT)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
word.map(|w| {
|
word.map(|w| {
|
||||||
shape::Text::new(base + Offset::x(WORD_X_OFFSET), w)
|
shape::Text::new(base + Offset::x(WORD_X_OFFSET), w, WORD_FONT)
|
||||||
.with_font(WORD_FONT)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
@ -60,8 +60,7 @@ impl Title {
|
|||||||
let text_height = theme::FONT_HEADER.text_height();
|
let text_height = theme::FONT_HEADER.text_height();
|
||||||
let title_baseline = area.top_left() + Offset::y(text_height - 1);
|
let title_baseline = area.top_left() + Offset::y(text_height - 1);
|
||||||
title.map(|s| {
|
title.map(|s| {
|
||||||
shape::Text::new(title_baseline, s)
|
shape::Text::new(title_baseline, s, theme::FONT_HEADER)
|
||||||
.with_font(theme::FONT_HEADER)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
@ -76,9 +75,8 @@ impl Title {
|
|||||||
let text_height = theme::FONT_HEADER.text_height();
|
let text_height = theme::FONT_HEADER.text_height();
|
||||||
let title_baseline = area.top_center() + Offset::y(text_height - 1);
|
let title_baseline = area.top_center() + Offset::y(text_height - 1);
|
||||||
title.map(|s| {
|
title.map(|s| {
|
||||||
shape::Text::new(title_baseline, s)
|
shape::Text::new(title_baseline, s, theme::FONT_HEADER)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(theme::FONT_HEADER)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{component::text::TextStyle, display::Color, util::include_icon};
|
||||||
component::text::TextStyle,
|
|
||||||
display::{font, Color},
|
|
||||||
util::include_icon,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
use super::super::fonts;
|
||||||
pub use super::super::theme::{BLACK, WHITE};
|
pub use super::super::theme::{BLACK, WHITE};
|
||||||
|
|
||||||
pub const BLD_BG: Color = BLACK;
|
pub const BLD_BG: Color = BLACK;
|
||||||
@ -17,5 +14,5 @@ include_icon!(ICON_REDO, "layout_caesar/res/redo.toif");
|
|||||||
include_icon!(ICON_EXIT, "layout_caesar/res/exit.toif");
|
include_icon!(ICON_EXIT, "layout_caesar/res/exit.toif");
|
||||||
|
|
||||||
pub const TEXT_NORMAL: TextStyle =
|
pub const TEXT_NORMAL: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
TextStyle::new(fonts::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(font::FONT_BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
pub const TEXT_BOLD: TextStyle = TextStyle::new(fonts::FONT_BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||||
|
@ -3,11 +3,13 @@ use crate::ui::{
|
|||||||
text::{layout::Chunks, TextStyle},
|
text::{layout::Chunks, TextStyle},
|
||||||
LineBreaking, PageBreaking,
|
LineBreaking, PageBreaking,
|
||||||
},
|
},
|
||||||
display::{font, Color, Font},
|
display::{Color, Font},
|
||||||
geometry::Offset,
|
geometry::Offset,
|
||||||
util::include_icon,
|
util::include_icon,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::fonts;
|
||||||
|
|
||||||
pub mod bootloader;
|
pub mod bootloader;
|
||||||
|
|
||||||
// Color palette.
|
// Color palette.
|
||||||
@ -17,26 +19,26 @@ pub const FG: Color = WHITE; // Default foreground (text & icon) color.
|
|||||||
pub const BG: Color = BLACK; // Default background color.
|
pub const BG: Color = BLACK; // Default background color.
|
||||||
|
|
||||||
// Font constants.
|
// Font constants.
|
||||||
pub const FONT_BUTTON: Font = font::FONT_NORMAL_UPPER;
|
pub const FONT_BUTTON: Font = fonts::FONT_NORMAL_UPPER;
|
||||||
pub const FONT_HEADER: Font = font::FONT_BOLD_UPPER;
|
pub const FONT_HEADER: Font = fonts::FONT_BOLD_UPPER;
|
||||||
pub const FONT_CHOICE_ITEMS: Font = font::FONT_BIG;
|
pub const FONT_CHOICE_ITEMS: Font = fonts::FONT_BIG;
|
||||||
|
|
||||||
// Text constants.
|
// Text constants.
|
||||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(font::FONT_NORMAL, FG, BG, FG, FG)
|
pub const TEXT_NORMAL: TextStyle = TextStyle::new(fonts::FONT_NORMAL, FG, BG, FG, FG)
|
||||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||||
pub const TEXT_BIG: TextStyle = TextStyle::new(font::FONT_BIG, FG, BG, FG, FG);
|
pub const TEXT_BIG: TextStyle = TextStyle::new(fonts::FONT_BIG, FG, BG, FG, FG);
|
||||||
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(font::FONT_DEMIBOLD, FG, BG, FG, FG);
|
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(fonts::FONT_DEMIBOLD, FG, BG, FG, FG);
|
||||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(font::FONT_BOLD, FG, BG, FG, FG)
|
pub const TEXT_BOLD: TextStyle = TextStyle::new(fonts::FONT_BOLD, FG, BG, FG, FG)
|
||||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||||
pub const TEXT_BOLD_UPPER: TextStyle = TextStyle::new(font::FONT_BOLD_UPPER, FG, BG, FG, FG)
|
pub const TEXT_BOLD_UPPER: TextStyle = TextStyle::new(fonts::FONT_BOLD_UPPER, FG, BG, FG, FG)
|
||||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||||
pub const TEXT_MONO: TextStyle = TextStyle::new(font::FONT_MONO, FG, BG, FG, FG)
|
pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, FG, FG)
|
||||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||||
|
@ -20,7 +20,6 @@ use crate::{
|
|||||||
},
|
},
|
||||||
Component, ComponentExt, Empty, FormattedText, Label, LineBreaking, Paginate, Timeout,
|
Component, ComponentExt, Empty, FormattedText, Label, LineBreaking, Paginate, Timeout,
|
||||||
},
|
},
|
||||||
display::font,
|
|
||||||
geometry,
|
geometry,
|
||||||
layout::{
|
layout::{
|
||||||
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
|
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
|
||||||
@ -40,7 +39,7 @@ use super::{
|
|||||||
PassphraseEntry, PinEntry, Progress, ScrollableFrame, ShareWords, ShowMore, SimpleChoice,
|
PassphraseEntry, PinEntry, Progress, ScrollableFrame, ShareWords, ShowMore, SimpleChoice,
|
||||||
WordlistEntry, WordlistType,
|
WordlistEntry, WordlistType,
|
||||||
},
|
},
|
||||||
constant, theme, UICaesar,
|
constant, fonts, theme, UICaesar,
|
||||||
};
|
};
|
||||||
|
|
||||||
use heapless::Vec;
|
use heapless::Vec;
|
||||||
@ -116,13 +115,13 @@ impl FirmwareUI for UICaesar {
|
|||||||
if chunkify {
|
if chunkify {
|
||||||
ops = ops.chunkify_text(None);
|
ops = ops.chunkify_text(None);
|
||||||
}
|
}
|
||||||
ops = ops.text_normal(label).newline();
|
ops = ops.text(label, fonts::FONT_NORMAL).newline();
|
||||||
}
|
}
|
||||||
if chunkify {
|
if chunkify {
|
||||||
// Chunkifying the address into smaller pieces when requested
|
// Chunkifying the address into smaller pieces when requested
|
||||||
ops = ops.chunkify_text(Some((theme::MONO_CHUNKS, 2)));
|
ops = ops.chunkify_text(Some((theme::MONO_CHUNKS, 2)));
|
||||||
}
|
}
|
||||||
ops = ops.text_mono(address);
|
ops = ops.text(address, fonts::FONT_MONO);
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
Page::new(btn_layout, btn_actions, formatted).with_title(title)
|
Page::new(btn_layout, btn_actions, formatted).with_title(title)
|
||||||
};
|
};
|
||||||
@ -271,9 +270,9 @@ impl FirmwareUI for UICaesar {
|
|||||||
|
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
||||||
.newline()
|
.newline()
|
||||||
.text_normal(app_name)
|
.text(app_name, fonts::FONT_NORMAL)
|
||||||
.newline()
|
.newline()
|
||||||
.text_bold(account);
|
.text(account, fonts::FONT_BOLD);
|
||||||
let formatted = FormattedText::new(ops);
|
let formatted = FormattedText::new(ops);
|
||||||
|
|
||||||
Page::new(btn_layout, btn_actions, formatted)
|
Page::new(btn_layout, btn_actions, formatted)
|
||||||
@ -473,11 +472,11 @@ impl FirmwareUI for UICaesar {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
||||||
.text_normal(TR::reset__by_continuing)
|
.text(TR::reset__by_continuing, fonts::FONT_NORMAL)
|
||||||
.next_page()
|
.next_page()
|
||||||
.text_normal(TR::reset__more_info_at)
|
.text(TR::reset__more_info_at, fonts::FONT_NORMAL)
|
||||||
.newline()
|
.newline()
|
||||||
.text_bold(TR::reset__tos_link);
|
.text(TR::reset__tos_link, fonts::FONT_BOLD);
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
|
|
||||||
content_in_button_page(title, formatted, button, Some("".into()), false)
|
content_in_button_page(title, formatted, button, Some("".into()), false)
|
||||||
@ -514,7 +513,7 @@ impl FirmwareUI for UICaesar {
|
|||||||
let right_btn = has_pages_after.then(|| {
|
let right_btn = has_pages_after.then(|| {
|
||||||
ButtonDetails::text("i".into())
|
ButtonDetails::text("i".into())
|
||||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||||
.with_font(font::FONT_NORMAL)
|
.with_font(fonts::FONT_NORMAL)
|
||||||
});
|
});
|
||||||
let middle_btn = Some(ButtonDetails::armed_text(TR::buttons__confirm.into()));
|
let middle_btn = Some(ButtonDetails::armed_text(TR::buttons__confirm.into()));
|
||||||
|
|
||||||
@ -550,14 +549,14 @@ impl FirmwareUI for UICaesar {
|
|||||||
let (btn_layout, btn_actions) = btns_summary_page(!info_pages.is_empty());
|
let (btn_layout, btn_actions) = btns_summary_page(!info_pages.is_empty());
|
||||||
|
|
||||||
let ops = OpTextLayout::new(theme::TEXT_MONO)
|
let ops = OpTextLayout::new(theme::TEXT_MONO)
|
||||||
.text_bold(amount_label)
|
.text(amount_label, fonts::FONT_BOLD)
|
||||||
.newline()
|
.newline()
|
||||||
.text_mono(amount)
|
.text(amount, fonts::FONT_MONO)
|
||||||
.newline()
|
.newline()
|
||||||
.newline()
|
.newline()
|
||||||
.text_bold(fee_label)
|
.text(fee_label, fonts::FONT_BOLD)
|
||||||
.newline()
|
.newline()
|
||||||
.text_mono(fee);
|
.text(fee, fonts::FONT_MONO);
|
||||||
|
|
||||||
let formatted = FormattedText::new(ops);
|
let formatted = FormattedText::new(ops);
|
||||||
Page::new(btn_layout, btn_actions, formatted)
|
Page::new(btn_layout, btn_actions, formatted)
|
||||||
@ -576,9 +575,9 @@ impl FirmwareUI for UICaesar {
|
|||||||
ops = ops.next_page();
|
ops = ops.next_page();
|
||||||
}
|
}
|
||||||
ops = ops
|
ops = ops
|
||||||
.text_bold(unwrap!(TString::try_from(key)))
|
.text(unwrap!(TString::try_from(key)), fonts::FONT_BOLD)
|
||||||
.newline()
|
.newline()
|
||||||
.text_mono(unwrap!(TString::try_from(value)));
|
.text(unwrap!(TString::try_from(value)), fonts::FONT_MONO);
|
||||||
}
|
}
|
||||||
|
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
@ -767,7 +766,7 @@ impl FirmwareUI for UICaesar {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL).text_normal(text);
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL).text(text, fonts::FONT_NORMAL);
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
|
|
||||||
Page::new(btn_layout, btn_actions, formatted)
|
Page::new(btn_layout, btn_actions, formatted)
|
||||||
@ -784,9 +783,9 @@ impl FirmwareUI for UICaesar {
|
|||||||
let btn_layout = ButtonLayout::text_none_arrow_wide(TR::buttons__skip.into());
|
let btn_layout = ButtonLayout::text_none_arrow_wide(TR::buttons__skip.into());
|
||||||
let btn_actions = ButtonActions::cancel_none_next();
|
let btn_actions = ButtonActions::cancel_none_next();
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
||||||
.text_normal(TR::backup__new_wallet_created)
|
.text(TR::backup__new_wallet_created, fonts::FONT_NORMAL)
|
||||||
.newline()
|
.newline()
|
||||||
.text_normal(TR::backup__it_should_be_backed_up_now);
|
.text(TR::backup__it_should_be_backed_up_now, fonts::FONT_NORMAL);
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
Page::new(btn_layout, btn_actions, formatted)
|
Page::new(btn_layout, btn_actions, formatted)
|
||||||
.with_title(TR::words__title_success.into())
|
.with_title(TR::words__title_success.into())
|
||||||
@ -794,8 +793,8 @@ impl FirmwareUI for UICaesar {
|
|||||||
1 => {
|
1 => {
|
||||||
let btn_layout = ButtonLayout::up_arrow_none_text(TR::buttons__back_up.into());
|
let btn_layout = ButtonLayout::up_arrow_none_text(TR::buttons__back_up.into());
|
||||||
let btn_actions = ButtonActions::prev_none_confirm();
|
let btn_actions = ButtonActions::prev_none_confirm();
|
||||||
let ops =
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
||||||
OpTextLayout::new(theme::TEXT_NORMAL).text_normal(TR::backup__recover_anytime);
|
.text(TR::backup__recover_anytime, fonts::FONT_NORMAL);
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
Page::new(btn_layout, btn_actions, formatted)
|
Page::new(btn_layout, btn_actions, formatted)
|
||||||
.with_title(TR::backup__title_backup_wallet.into())
|
.with_title(TR::backup__title_backup_wallet.into())
|
||||||
@ -1070,12 +1069,12 @@ impl FirmwareUI for UICaesar {
|
|||||||
let btn_layout = ButtonLayout::arrow_none_text(TR::buttons__quit.into());
|
let btn_layout = ButtonLayout::arrow_none_text(TR::buttons__quit.into());
|
||||||
let btn_actions = ButtonActions::cancel_none_confirm();
|
let btn_actions = ButtonActions::cancel_none_confirm();
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
||||||
.text_bold_upper(title)
|
.text(title, fonts::FONT_BOLD_UPPER)
|
||||||
.newline()
|
.newline()
|
||||||
.newline_half()
|
.newline_half()
|
||||||
.text_normal(TR::addr_mismatch__contact_support_at)
|
.text(TR::addr_mismatch__contact_support_at, fonts::FONT_NORMAL)
|
||||||
.newline()
|
.newline()
|
||||||
.text_bold(TR::addr_mismatch__support_url);
|
.text(TR::addr_mismatch__support_url, fonts::FONT_BOLD);
|
||||||
let formatted = FormattedText::new(ops);
|
let formatted = FormattedText::new(ops);
|
||||||
Page::new(btn_layout, btn_actions, formatted)
|
Page::new(btn_layout, btn_actions, formatted)
|
||||||
};
|
};
|
||||||
@ -1172,7 +1171,8 @@ impl FirmwareUI for UICaesar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
|
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
let layout = RootComponent::new(Connect::new(text, theme::FG, theme::BG));
|
let layout =
|
||||||
|
RootComponent::new(Connect::new(text, fonts::FONT_NORMAL, theme::FG, theme::BG));
|
||||||
Ok(layout)
|
Ok(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1192,13 +1192,13 @@ impl FirmwareUI for UICaesar {
|
|||||||
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
|
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
|
||||||
ops = ops.alignment(geometry::Alignment::Center);
|
ops = ops.alignment(geometry::Alignment::Center);
|
||||||
if !value.is_empty() {
|
if !value.is_empty() {
|
||||||
ops = ops.text_bold_upper(value);
|
ops = ops.text(value, fonts::FONT_BOLD_UPPER);
|
||||||
if !description.is_empty() {
|
if !description.is_empty() {
|
||||||
ops = ops.newline();
|
ops = ops.newline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !description.is_empty() {
|
if !description.is_empty() {
|
||||||
ops = ops.text_normal(description);
|
ops = ops.text(description, fonts::FONT_NORMAL);
|
||||||
}
|
}
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
Page::new(btn_layout, btn_actions, formatted)
|
Page::new(btn_layout, btn_actions, formatted)
|
||||||
@ -1327,7 +1327,7 @@ fn tutorial_screen(
|
|||||||
btn_layout: ButtonLayout,
|
btn_layout: ButtonLayout,
|
||||||
btn_actions: ButtonActions,
|
btn_actions: ButtonActions,
|
||||||
) -> Page {
|
) -> Page {
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL).text_normal(text);
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL).text(text, fonts::FONT_NORMAL);
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
Page::new(btn_layout, btn_actions, formatted).with_title(title)
|
Page::new(btn_layout, btn_actions, formatted).with_title(title)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ use crate::{
|
|||||||
trezorhal::secbool::secbool,
|
trezorhal::secbool::secbool,
|
||||||
ui::{
|
ui::{
|
||||||
component::{connect::Connect, Label},
|
component::{connect::Connect, Label},
|
||||||
display::{self, font, Color, Icon},
|
display::{self, Color, Icon},
|
||||||
geometry::{Alignment, Offset, Point, Rect},
|
geometry::{Alignment, Offset, Point, Rect},
|
||||||
layout::simplified::{run, show},
|
layout::simplified::{run, show},
|
||||||
},
|
},
|
||||||
@ -17,8 +17,9 @@ use super::{
|
|||||||
Button, ResultScreen, WelcomeScreen,
|
Button, ResultScreen, WelcomeScreen,
|
||||||
},
|
},
|
||||||
cshape::{render_loader, LoaderRange},
|
cshape::{render_loader, LoaderRange},
|
||||||
theme,
|
fonts,
|
||||||
theme::{
|
theme::{
|
||||||
|
backlight,
|
||||||
bootloader::{
|
bootloader::{
|
||||||
button_bld, button_bld_menu, button_confirm, button_wipe_cancel, button_wipe_confirm,
|
button_bld, button_bld_menu, button_confirm, button_wipe_cancel, button_wipe_confirm,
|
||||||
BLD_BG, BLD_FG, BLD_TITLE_COLOR, BLD_WIPE_COLOR, CHECK24, CHECK40, DOWNLOAD24, FIRE32,
|
BLD_BG, BLD_FG, BLD_TITLE_COLOR, BLD_WIPE_COLOR, CHECK24, CHECK40, DOWNLOAD24, FIRE32,
|
||||||
@ -72,8 +73,7 @@ impl UIDelizia {
|
|||||||
display::sync();
|
display::sync();
|
||||||
|
|
||||||
render_on_display(None, Some(bg_color), |target| {
|
render_on_display(None, Some(bg_color), |target| {
|
||||||
shape::Text::new(PROGRESS_TEXT_ORIGIN, text)
|
shape::Text::new(PROGRESS_TEXT_ORIGIN, text, fonts::FONT_DEMIBOLD)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
@ -107,9 +107,9 @@ impl UIDelizia {
|
|||||||
shape::Text::new(
|
shape::Text::new(
|
||||||
SCREEN.center() + Offset::y(loader_offset + center_text_offset),
|
SCREEN.center() + Offset::y(loader_offset + center_text_offset),
|
||||||
center_text,
|
center_text,
|
||||||
|
fonts::FONT_DEMIBOLD,
|
||||||
)
|
)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(GREY)
|
.with_fg(GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ impl BootloaderUI for UIDelizia {
|
|||||||
if fading {
|
if fading {
|
||||||
Self::fadein();
|
Self::fadein();
|
||||||
} else {
|
} else {
|
||||||
display::set_backlight(theme::backlight::get_backlight_normal());
|
display::set_backlight(backlight::get_backlight_normal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +359,12 @@ impl BootloaderUI for UIDelizia {
|
|||||||
|
|
||||||
fn screen_connect(initial_setup: bool) {
|
fn screen_connect(initial_setup: bool) {
|
||||||
let bg = if initial_setup { WELCOME_COLOR } else { BLD_BG };
|
let bg = if initial_setup { WELCOME_COLOR } else { BLD_BG };
|
||||||
let mut frame = Connect::new("Waiting for host...", BLD_TITLE_COLOR, bg);
|
let mut frame = Connect::new(
|
||||||
|
"Waiting for host...",
|
||||||
|
fonts::FONT_DEMIBOLD,
|
||||||
|
BLD_TITLE_COLOR,
|
||||||
|
bg,
|
||||||
|
);
|
||||||
show(&mut frame, true);
|
show(&mut frame, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,9 +428,8 @@ impl BootloaderUI for UIDelizia {
|
|||||||
// Draw vendor string if present
|
// Draw vendor string if present
|
||||||
if let Some(text) = vendor_str {
|
if let Some(text) = vendor_str {
|
||||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5 - 50);
|
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5 - 50);
|
||||||
shape::Text::new(pos, text)
|
shape::Text::new(pos, text, fonts::FONT_DEMIBOLD)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG) //COLOR_BL_BG
|
.with_fg(BLD_FG) //COLOR_BL_BG
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
@ -440,9 +444,8 @@ impl BootloaderUI for UIDelizia {
|
|||||||
version[2]
|
version[2]
|
||||||
));
|
));
|
||||||
|
|
||||||
shape::Text::new(pos, version_text.as_str())
|
shape::Text::new(pos, version_text.as_str(), fonts::FONT_DEMIBOLD)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
@ -455,17 +458,15 @@ impl BootloaderUI for UIDelizia {
|
|||||||
unwrap!(uwrite!(text, "starting in {} s", wait));
|
unwrap!(uwrite!(text, "starting in {} s", wait));
|
||||||
|
|
||||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||||
shape::Text::new(pos, text.as_str())
|
shape::Text::new(pos, text.as_str(), fonts::FONT_DEMIBOLD)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
core::cmp::Ordering::Less => {
|
core::cmp::Ordering::Less => {
|
||||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||||
shape::Text::new(pos, "click to continue ...")
|
shape::Text::new(pos, "click to continue ...", fonts::FONT_DEMIBOLD)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(BLD_FG)
|
.with_fg(BLD_FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Pad},
|
component::{Component, Event, EventCtx, Never, Pad},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::font,
|
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::theme::{BLACK, GREY, WHITE};
|
use super::{
|
||||||
|
super::theme::{BLACK, GREY, WHITE},
|
||||||
|
fonts,
|
||||||
|
};
|
||||||
|
|
||||||
const TEXT_ORIGIN: Point = Point::new(0, 105);
|
const TEXT_ORIGIN: Point = Point::new(0, 105);
|
||||||
const STRIDE: i16 = 22;
|
const STRIDE: i16 = 22;
|
||||||
@ -37,29 +39,27 @@ impl Component for Welcome {
|
|||||||
|
|
||||||
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
self.bg.render(target);
|
self.bg.render(target);
|
||||||
|
let font = fonts::FONT_DEMIBOLD;
|
||||||
|
|
||||||
shape::Text::new(TEXT_ORIGIN, "Get started")
|
shape::Text::new(TEXT_ORIGIN, "Get started", font)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(GREY)
|
.with_fg(GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(TEXT_ORIGIN + Offset::y(STRIDE), "with your Trezor")
|
shape::Text::new(TEXT_ORIGIN + Offset::y(STRIDE), "with your Trezor", font)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(GREY)
|
.with_fg(GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(TEXT_ORIGIN + Offset::y(2 * STRIDE), "at")
|
shape::Text::new(TEXT_ORIGIN + Offset::y(2 * STRIDE), "at", font)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(GREY)
|
.with_fg(GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
let at_width = font::FONT_NORMAL.text_width("at ");
|
let at_width = font.text_width("at ");
|
||||||
|
|
||||||
shape::Text::new(
|
shape::Text::new(
|
||||||
TEXT_ORIGIN + Offset::new(at_width, 2 * STRIDE),
|
TEXT_ORIGIN + Offset::new(at_width, 2 * STRIDE),
|
||||||
"trezor.io/start",
|
"trezor.io/start",
|
||||||
|
font,
|
||||||
)
|
)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(WHITE)
|
.with_fg(WHITE)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,7 @@ impl Button {
|
|||||||
Alignment::End => self.area.right_center() - Offset::x(Self::BASELINE_OFFSET.x),
|
Alignment::End => self.area.right_center() - Offset::x(Self::BASELINE_OFFSET.x),
|
||||||
} + y_offset;
|
} + y_offset;
|
||||||
text.map(|text| {
|
text.map(|text| {
|
||||||
shape::Text::new(start_of_baseline, text)
|
shape::Text::new(start_of_baseline, text, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.with_align(self.text_align)
|
.with_align(self.text_align)
|
||||||
.with_alpha(alpha)
|
.with_alpha(alpha)
|
||||||
@ -438,8 +437,7 @@ impl IconText {
|
|||||||
let mut show_text = |text: &str, rect: Rect| {
|
let mut show_text = |text: &str, rect: Rect| {
|
||||||
let text_pos = rect.left_center() + baseline_offset;
|
let text_pos = rect.left_center() + baseline_offset;
|
||||||
let text_pos = Point::new(rect.top_left().x + Self::ICON_SPACE, text_pos.y);
|
let text_pos = Point::new(rect.top_left().x + Self::ICON_SPACE, text_pos.y);
|
||||||
shape::Text::new(text_pos, text)
|
shape::Text::new(text_pos, text, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.with_alpha(alpha)
|
.with_alpha(alpha)
|
||||||
.render(target)
|
.render(target)
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
component::{text::TextStyle, Component, Event, EventCtx, Never},
|
component::{text::TextStyle, Component, Event, EventCtx, Never},
|
||||||
display::{font::FONT_SUB, Color, Font},
|
display::{Color, Font},
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Alignment, Alignment2D, Direction, Offset, Point, Rect},
|
geometry::{Alignment, Alignment2D, Direction, Offset, Point, Rect},
|
||||||
lerp::Lerp,
|
lerp::Lerp,
|
||||||
@ -10,7 +10,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::theme;
|
use super::{super::fonts::FONT_SUB, theme};
|
||||||
|
|
||||||
/// Component showing a task instruction, e.g. "Swipe up", and an optional
|
/// Component showing a task instruction, e.g. "Swipe up", and an optional
|
||||||
/// content consisting of one of these:
|
/// content consisting of one of these:
|
||||||
@ -278,11 +278,14 @@ impl<'a> FooterContent<'a> {
|
|||||||
area_description.bottom_center() - Offset::y(text_description_font_descent);
|
area_description.bottom_center() - Offset::y(text_description_font_descent);
|
||||||
|
|
||||||
description.map(|t| {
|
description.map(|t| {
|
||||||
Text::new(text_description_baseline, t)
|
Text::new(
|
||||||
.with_font(Footer::STYLE_DESCRIPTION.text_font)
|
text_description_baseline,
|
||||||
.with_fg(Footer::STYLE_DESCRIPTION.text_color)
|
t,
|
||||||
.with_align(Alignment::Center)
|
Footer::STYLE_DESCRIPTION.text_font,
|
||||||
.render(target)
|
)
|
||||||
|
.with_fg(Footer::STYLE_DESCRIPTION.text_color)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.render(target)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,11 +302,14 @@ impl<'a> FooterContent<'a> {
|
|||||||
let text_instruction_baseline =
|
let text_instruction_baseline =
|
||||||
area_instruction.bottom_center() - Offset::y(text_instruction_font_descent);
|
area_instruction.bottom_center() - Offset::y(text_instruction_font_descent);
|
||||||
instruction.map(|t| {
|
instruction.map(|t| {
|
||||||
Text::new(text_instruction_baseline, t)
|
Text::new(
|
||||||
.with_font(Footer::STYLE_INSTRUCTION.text_font)
|
text_instruction_baseline,
|
||||||
.with_fg(Footer::STYLE_INSTRUCTION.text_color)
|
t,
|
||||||
.with_align(Alignment::Center)
|
Footer::STYLE_INSTRUCTION.text_font,
|
||||||
.render(target)
|
)
|
||||||
|
.with_fg(Footer::STYLE_INSTRUCTION.text_color)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.render(target)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -369,19 +375,17 @@ impl PageCounter {
|
|||||||
let base_foreslash = Point::new(counter_start_x + width_num_curr + offset_x.x, counter_y);
|
let base_foreslash = Point::new(counter_start_x + width_num_curr + offset_x.x, counter_y);
|
||||||
let base_num_max = Point::new(counter_end_x, counter_y);
|
let base_num_max = Point::new(counter_end_x, counter_y);
|
||||||
|
|
||||||
Text::new(base_num_curr, &string_curr)
|
Text::new(base_num_curr, &string_curr, self.font)
|
||||||
.with_align(Alignment::Start)
|
.with_align(Alignment::Start)
|
||||||
.with_fg(color)
|
.with_fg(color)
|
||||||
.with_font(self.font)
|
|
||||||
.render(target);
|
.render(target);
|
||||||
shape::ToifImage::new(base_foreslash, theme::ICON_FORESLASH.toif)
|
shape::ToifImage::new(base_foreslash, theme::ICON_FORESLASH.toif)
|
||||||
.with_align(Alignment2D::BOTTOM_LEFT)
|
.with_align(Alignment2D::BOTTOM_LEFT)
|
||||||
.with_fg(color)
|
.with_fg(color)
|
||||||
.render(target);
|
.render(target);
|
||||||
Text::new(base_num_max, &string_max)
|
Text::new(base_num_max, &string_max, self.font)
|
||||||
.with_align(Alignment::End)
|
.with_align(Alignment::End)
|
||||||
.with_fg(color)
|
.with_fg(color)
|
||||||
.with_font(self.font)
|
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
FooterContent::render_instruction(target, area, &self.instruction);
|
FooterContent::render_instruction(target, area, &self.instruction);
|
||||||
|
@ -7,7 +7,7 @@ use crate::{
|
|||||||
trezorhal::usb::usb_configured,
|
trezorhal::usb::usb_configured,
|
||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Timer},
|
component::{Component, Event, EventCtx, Timer},
|
||||||
display::{font, image::ImageInfo, Color},
|
display::{image::ImageInfo, Color},
|
||||||
event::TouchEvent,
|
event::TouchEvent,
|
||||||
geometry::{Alignment, Alignment2D, Offset, Point, Rect},
|
geometry::{Alignment, Alignment2D, Offset, Point, Rect},
|
||||||
layout::util::get_user_custom_image,
|
layout::util::get_user_custom_image,
|
||||||
@ -24,7 +24,10 @@ use crate::ui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
super::cshape::{self, UnlockOverlay},
|
super::{
|
||||||
|
cshape::{self, UnlockOverlay},
|
||||||
|
fonts,
|
||||||
|
},
|
||||||
constant, theme,
|
constant, theme,
|
||||||
theme::{GREY_LIGHT, HOMESCREEN_ICON, ICON_KEY},
|
theme::{GREY_LIGHT, HOMESCREEN_ICON, ICON_KEY},
|
||||||
Loader, LoaderMsg,
|
Loader, LoaderMsg,
|
||||||
@ -83,8 +86,7 @@ fn render_notif<'s>(notif: HomescreenNotification, top: i16, target: &mut impl R
|
|||||||
.with_alpha(NOTIFICATION_BG_ALPHA)
|
.with_alpha(NOTIFICATION_BG_ALPHA)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(text_pos, t)
|
shape::Text::new(text_pos, t, style.text_font)
|
||||||
.with_font(style.text_font)
|
|
||||||
.with_fg(notif.color_text)
|
.with_fg(notif.color_text)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
@ -491,9 +493,8 @@ impl Homescreen {
|
|||||||
|
|
||||||
fn render_loader<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render_loader<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
TR::progress__locking_device.map_translated(|t| {
|
TR::progress__locking_device.map_translated(|t| {
|
||||||
shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t)
|
shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t, fonts::FONT_NORMAL)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(theme::FG);
|
.with_fg(theme::FG);
|
||||||
});
|
});
|
||||||
self.loader.render(target)
|
self.loader.render(target)
|
||||||
@ -855,8 +856,7 @@ impl Component for Lockscreen {
|
|||||||
t.map_translated(|t| {
|
t.map_translated(|t| {
|
||||||
let text_pos = Point::new(6, offset);
|
let text_pos = Point::new(6, offset);
|
||||||
|
|
||||||
shape::Text::new(text_pos, t)
|
shape::Text::new(text_pos, t, theme::TEXT_SUB_GREY.text_font)
|
||||||
.with_font(theme::TEXT_SUB_GREY.text_font)
|
|
||||||
.with_fg(theme::TEXT_SUB_GREY.text_color)
|
.with_fg(theme::TEXT_SUB_GREY.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
})
|
})
|
||||||
@ -873,8 +873,7 @@ impl Component for Lockscreen {
|
|||||||
screen().y1 - offset,
|
screen().y1 - offset,
|
||||||
);
|
);
|
||||||
|
|
||||||
shape::Text::new(text_pos, t)
|
shape::Text::new(text_pos, t, theme::TEXT_SUB_GREY.text_font)
|
||||||
.with_font(theme::TEXT_SUB_GREY.text_font)
|
|
||||||
.with_fg(theme::GREY_DARK)
|
.with_fg(theme::GREY_DARK)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
@ -142,16 +142,14 @@ impl Component for Bip39Input {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Render text input + suggested completion
|
// Render text input + suggested completion
|
||||||
shape::Text::new(text_base, text)
|
shape::Text::new(text_base, text, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.with_align(Alignment::Start)
|
.with_align(Alignment::Start)
|
||||||
.render(target);
|
.render(target);
|
||||||
if let Some(word) = self.suggested_word.and_then(|w| w.get(text.len()..)) {
|
if let Some(word) = self.suggested_word.and_then(|w| w.get(text.len()..)) {
|
||||||
let word_baseline = text_base + Offset::x(width);
|
let word_baseline = text_base + Offset::x(width);
|
||||||
let style = self.button_suggestion.style();
|
let style = self.button_suggestion.style();
|
||||||
shape::Text::new(word_baseline, word)
|
shape::Text::new(word_baseline, word, style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.with_align(Alignment::Start)
|
.with_align(Alignment::Start)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
@ -458,8 +458,7 @@ impl Component for Input {
|
|||||||
let text_to_display =
|
let text_to_display =
|
||||||
long_line_content_with_ellipsis(text, "...", style.text_font, available_area_width);
|
long_line_content_with_ellipsis(text, "...", style.text_font, available_area_width);
|
||||||
|
|
||||||
shape::Text::new(text_baseline, &text_to_display)
|
shape::Text::new(text_baseline, &text_to_display, style.text_font)
|
||||||
.with_font(style.text_font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ use crate::{
|
|||||||
text::TextStyle,
|
text::TextStyle,
|
||||||
Component, Event, EventCtx, Label, Never, Pad, Timer,
|
Component, Event, EventCtx, Label, Never, Pad, Timer,
|
||||||
},
|
},
|
||||||
display::font::FONT_MONO,
|
|
||||||
event::TouchEvent,
|
event::TouchEvent,
|
||||||
geometry::{Alignment, Alignment2D, Direction, Grid, Insets, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Direction, Grid, Insets, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
@ -27,6 +26,7 @@ use super::super::super::{
|
|||||||
theme,
|
theme,
|
||||||
},
|
},
|
||||||
cshape,
|
cshape,
|
||||||
|
fonts::FONT_MONO,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub enum PinKeyboardMsg {
|
pub enum PinKeyboardMsg {
|
||||||
@ -609,16 +609,14 @@ impl PinDots {
|
|||||||
let digits = self.digits.len();
|
let digits = self.digits.len();
|
||||||
|
|
||||||
if digits <= MAX_VISIBLE_DIGITS {
|
if digits <= MAX_VISIBLE_DIGITS {
|
||||||
shape::Text::new(left, &self.digits)
|
shape::Text::new(left, &self.digits, FONT_MONO)
|
||||||
.with_align(Alignment::Start)
|
.with_align(Alignment::Start)
|
||||||
.with_font(FONT_MONO)
|
|
||||||
.with_fg(self.style.text_color)
|
.with_fg(self.style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
} else {
|
} else {
|
||||||
let offset: usize = digits.saturating_sub(MAX_VISIBLE_DIGITS);
|
let offset: usize = digits.saturating_sub(MAX_VISIBLE_DIGITS);
|
||||||
shape::Text::new(left, &self.digits[offset..])
|
shape::Text::new(left, &self.digits[offset..], FONT_MONO)
|
||||||
.with_align(Alignment::Start)
|
.with_align(Alignment::Start)
|
||||||
.with_font(FONT_MONO)
|
|
||||||
.with_fg(self.style.text_color)
|
.with_fg(self.style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
@ -669,9 +667,8 @@ impl PinDots {
|
|||||||
if last_digit && digits > 0 {
|
if last_digit && digits > 0 {
|
||||||
let last = &self.digits[(digits - 1)..digits];
|
let last = &self.digits[(digits - 1)..digits];
|
||||||
cursor.y = area.left_center().y + (FONT_MONO.visible_text_height("1") / 2);
|
cursor.y = area.left_center().y + (FONT_MONO.visible_text_height("1") / 2);
|
||||||
shape::Text::new(cursor, last)
|
shape::Text::new(cursor, last, FONT_MONO)
|
||||||
.with_align(Alignment::Start)
|
.with_align(Alignment::Start)
|
||||||
.with_font(FONT_MONO)
|
|
||||||
.with_fg(self.style.text_color)
|
.with_fg(self.style.text_color)
|
||||||
.render(target);
|
.render(target);
|
||||||
} else {
|
} else {
|
||||||
|
@ -166,8 +166,7 @@ impl Component for Slip39Input {
|
|||||||
.assert_if_debugging_ui("Text buffer is too small");
|
.assert_if_debugging_ui("Text buffer is too small");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shape::Text::new(text_center, text.as_str())
|
shape::Text::new(text_center, text.as_str(), style.font)
|
||||||
.with_font(style.font)
|
|
||||||
.with_fg(style.text_color)
|
.with_fg(style.text_color)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
@ -6,14 +6,13 @@ use crate::{
|
|||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
Component, Event, EventCtx, Pad,
|
Component, Event, EventCtx, Pad,
|
||||||
},
|
},
|
||||||
display::font::FONT_DEMIBOLD,
|
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Alignment, Direction, Grid, Insets, Offset, Rect},
|
geometry::{Alignment, Direction, Grid, Insets, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{theme, Button, ButtonMsg};
|
use super::{super::fonts::FONT_DEMIBOLD, theme, Button, ButtonMsg};
|
||||||
|
|
||||||
pub enum NumberInputDialogMsg {
|
pub enum NumberInputDialogMsg {
|
||||||
Confirmed(u32),
|
Confirmed(u32),
|
||||||
@ -156,10 +155,9 @@ impl Component for NumberInput {
|
|||||||
let y_offset = digit_font.text_height() / 2;
|
let y_offset = digit_font.text_height() / 2;
|
||||||
|
|
||||||
shape::Bar::new(self.area).with_bg(theme::BG).render(target);
|
shape::Bar::new(self.area).with_bg(theme::BG).render(target);
|
||||||
shape::Text::new(self.area.center() + Offset::y(y_offset), text)
|
shape::Text::new(self.area.center() + Offset::y(y_offset), text, digit_font)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.with_font(digit_font)
|
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,11 +225,14 @@ impl Component for NumberInputSlider {
|
|||||||
|
|
||||||
if !self.touching {
|
if !self.touching {
|
||||||
let text_height = theme::TEXT_BOLD.text_font.line_height();
|
let text_height = theme::TEXT_BOLD.text_font.line_height();
|
||||||
shape::Text::new(self.area.center() + Offset::new(0, text_height / 2), &str)
|
shape::Text::new(
|
||||||
.with_font(theme::TEXT_BOLD.text_font)
|
self.area.center() + Offset::new(0, text_height / 2),
|
||||||
.with_fg(theme::TEXT_BOLD.text_color)
|
&str,
|
||||||
.with_align(Alignment::Center)
|
theme::TEXT_BOLD.text_font,
|
||||||
.render(target);
|
)
|
||||||
|
.with_fg(theme::TEXT_BOLD.text_color)
|
||||||
|
.with_align(Alignment::Center)
|
||||||
|
.render(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
Component, Event, EventCtx, Label, Never, Pad,
|
Component, Event, EventCtx, Label, Never, Pad,
|
||||||
},
|
},
|
||||||
display::{font, LOADER_MAX},
|
display::LOADER_MAX,
|
||||||
geometry::{Insets, Offset, Rect},
|
geometry::{Insets, Offset, Rect},
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
util::animation_disabled,
|
util::animation_disabled,
|
||||||
@ -18,7 +18,7 @@ use crate::{
|
|||||||
use super::super::{
|
use super::super::{
|
||||||
constant,
|
constant,
|
||||||
cshape::{render_loader, LoaderRange},
|
cshape::{render_loader, LoaderRange},
|
||||||
theme,
|
fonts, theme,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Progress {
|
pub struct Progress {
|
||||||
@ -62,7 +62,7 @@ impl Component for Progress {
|
|||||||
.map(|t| t.chars().filter(|c| *c == '\n').count() as i16);
|
.map(|t| t.chars().filter(|c| *c == '\n').count() as i16);
|
||||||
let (title, rest) = Self::AREA.split_top(self.title.max_size().y);
|
let (title, rest) = Self::AREA.split_top(self.title.max_size().y);
|
||||||
let (loader, description) =
|
let (loader, description) =
|
||||||
rest.split_bottom(font::FONT_NORMAL.line_height() * description_lines);
|
rest.split_bottom(fonts::FONT_NORMAL.line_height() * description_lines);
|
||||||
let loader = loader.inset(Insets::top(theme::CONTENT_BORDER));
|
let loader = loader.inset(Insets::top(theme::CONTENT_BORDER));
|
||||||
self.title.place(title);
|
self.title.place(title);
|
||||||
self.loader_y_offset = loader.center().y - constant::screen().center().y;
|
self.loader_y_offset = loader.center().y - constant::screen().center().y;
|
||||||
|
@ -3,13 +3,14 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{text::TextStyle, Component, Event, EventCtx, Label, Never, Pad},
|
component::{text::TextStyle, Component, Event, EventCtx, Label, Never, Pad},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::{font, Color, Icon},
|
display::{Color, Icon},
|
||||||
geometry::{Alignment2D, Insets, Offset, Point, Rect},
|
geometry::{Alignment2D, Insets, Offset, Point, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
super::fonts,
|
||||||
constant::WIDTH,
|
constant::WIDTH,
|
||||||
theme::{FG, RESULT_FOOTER_START, RESULT_PADDING},
|
theme::{FG, RESULT_FOOTER_START, RESULT_PADDING},
|
||||||
};
|
};
|
||||||
@ -33,11 +34,11 @@ impl ResultStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const fn message_style(&self) -> TextStyle {
|
pub const fn message_style(&self) -> TextStyle {
|
||||||
TextStyle::new(font::FONT_NORMAL, self.fg_color, self.bg_color, FG, FG)
|
TextStyle::new(fonts::FONT_NORMAL, self.fg_color, self.bg_color, FG, FG)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn title_style(&self) -> TextStyle {
|
pub const fn title_style(&self) -> TextStyle {
|
||||||
TextStyle::new(font::FONT_BOLD, self.fg_color, self.bg_color, FG, FG)
|
TextStyle::new(fonts::FONT_BOLD, self.fg_color, self.bg_color, FG, FG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +94,7 @@ impl<'a> ShareWords<'a> {
|
|||||||
let word_baseline =
|
let word_baseline =
|
||||||
area.center() + Offset::y(theme::TEXT_SUPER.text_font.visible_text_height("A") / 2);
|
area.center() + Offset::y(theme::TEXT_SUPER.text_font.visible_text_height("A") / 2);
|
||||||
word.map(|w| {
|
word.map(|w| {
|
||||||
shape::Text::new(word_baseline, w)
|
shape::Text::new(word_baseline, w, theme::TEXT_SUPER.text_font)
|
||||||
.with_font(theme::TEXT_SUPER.text_font)
|
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
@ -207,8 +206,7 @@ impl<'a> Component for ShareWords<'a> {
|
|||||||
.visible_text_height("1"),
|
.visible_text_height("1"),
|
||||||
);
|
);
|
||||||
let ordinal = uformat!("{}.", ordinal_val);
|
let ordinal = uformat!("{}.", ordinal_val);
|
||||||
shape::Text::new(ordinal_pos, &ordinal)
|
shape::Text::new(ordinal_pos, &ordinal, theme::TEXT_SUB_GREY_LIGHT.text_font)
|
||||||
.with_font(theme::TEXT_SUB_GREY_LIGHT.text_font)
|
|
||||||
.with_fg(theme::GREY)
|
.with_fg(theme::GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Never},
|
component::{Component, Event, EventCtx, Never},
|
||||||
display::font,
|
|
||||||
geometry::{Alignment, Alignment2D, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::theme;
|
use super::{super::fonts, theme};
|
||||||
|
|
||||||
const TEXT_BOTTOM_MARGIN: i16 = 54;
|
const TEXT_BOTTOM_MARGIN: i16 = 54;
|
||||||
const ICON_TOP_MARGIN: i16 = 48;
|
const ICON_TOP_MARGIN: i16 = 48;
|
||||||
@ -47,9 +46,9 @@ impl Component for WelcomeScreen {
|
|||||||
shape::Text::new(
|
shape::Text::new(
|
||||||
self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN),
|
self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN),
|
||||||
model::FULL_NAME,
|
model::FULL_NAME,
|
||||||
|
fonts::FONT_NORMAL,
|
||||||
)
|
)
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_font(font::FONT_NORMAL)
|
|
||||||
.with_fg(theme::FG)
|
.with_fg(theme::FG)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{text::TextStyle, LineBreaking::BreakWordsNoHyphen},
|
component::{text::TextStyle, LineBreaking::BreakWordsNoHyphen},
|
||||||
constant::{HEIGHT, WIDTH},
|
constant::{HEIGHT, WIDTH},
|
||||||
display::{font, Color},
|
display::Color,
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
util::include_res,
|
util::include_res,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
component::{ButtonStyle, ButtonStyleSheet, ResultStyle},
|
component::{ButtonStyle, ButtonStyleSheet, ResultStyle},
|
||||||
|
fonts,
|
||||||
theme::{BLACK, FG, GREY_DARK, GREY_LIGHT, WHITE},
|
theme::{BLACK, FG, GREY_DARK, GREY_LIGHT, WHITE},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -73,21 +74,21 @@ pub const CHECK40: &[u8] = include_res!("layout_delizia/res/check40.toif");
|
|||||||
pub fn button_confirm() -> ButtonStyleSheet {
|
pub fn button_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_BG,
|
text_color: BLD_BG,
|
||||||
button_color: WHITE,
|
button_color: WHITE,
|
||||||
icon_color: BLD_BG,
|
icon_color: BLD_BG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_BG,
|
text_color: BLD_BG,
|
||||||
button_color: BLD_INSTALL_BTN_COLOR_ACTIVE,
|
button_color: BLD_INSTALL_BTN_COLOR_ACTIVE,
|
||||||
icon_color: BLD_BG,
|
icon_color: BLD_BG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
icon_color: BLD_BG,
|
icon_color: BLD_BG,
|
||||||
@ -99,21 +100,21 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
|||||||
pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: WHITE,
|
text_color: WHITE,
|
||||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR,
|
button_color: BLD_WIPE_CANCEL_BTN_COLOR,
|
||||||
icon_color: WHITE,
|
icon_color: WHITE,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: WHITE,
|
text_color: WHITE,
|
||||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR_ACTIVE,
|
button_color: BLD_WIPE_CANCEL_BTN_COLOR_ACTIVE,
|
||||||
icon_color: WHITE,
|
icon_color: WHITE,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
@ -125,21 +126,21 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
|||||||
pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_WIPE_COLOR,
|
text_color: BLD_WIPE_COLOR,
|
||||||
button_color: BLD_WIPE_BTN_COLOR,
|
button_color: BLD_WIPE_BTN_COLOR,
|
||||||
icon_color: BLD_WIPE_COLOR,
|
icon_color: BLD_WIPE_COLOR,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_WIPE_COLOR,
|
text_color: BLD_WIPE_COLOR,
|
||||||
button_color: BLD_WIPE_BTN_COLOR_ACTIVE,
|
button_color: BLD_WIPE_BTN_COLOR_ACTIVE,
|
||||||
icon_color: BLD_WIPE_COLOR,
|
icon_color: BLD_WIPE_COLOR,
|
||||||
background_color: BLD_WIPE_COLOR,
|
background_color: BLD_WIPE_COLOR,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_DARK,
|
button_color: GREY_DARK,
|
||||||
icon_color: FG,
|
icon_color: FG,
|
||||||
@ -151,21 +152,21 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
|||||||
pub fn button_bld_menu() -> ButtonStyleSheet {
|
pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BG,
|
button_color: BLD_BG,
|
||||||
icon_color: BLD_FG,
|
icon_color: BLD_FG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BG,
|
button_color: BLD_BG,
|
||||||
icon_color: BLD_FG,
|
icon_color: BLD_FG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BLD_BG,
|
button_color: BLD_BG,
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
@ -177,21 +178,21 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
|||||||
pub fn button_bld() -> ButtonStyleSheet {
|
pub fn button_bld() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BTN_COLOR,
|
button_color: BLD_BTN_COLOR,
|
||||||
icon_color: BLD_FG,
|
icon_color: BLD_FG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: BLD_FG,
|
text_color: BLD_FG,
|
||||||
button_color: BLD_BTN_COLOR_ACTIVE,
|
button_color: BLD_BTN_COLOR_ACTIVE,
|
||||||
icon_color: BLD_FG,
|
icon_color: BLD_FG,
|
||||||
background_color: BLD_BG,
|
background_color: BLD_BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: font::FONT_BOLD,
|
font: fonts::FONT_BOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BLD_BTN_COLOR,
|
button_color: BLD_BTN_COLOR,
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
@ -202,7 +203,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
|||||||
|
|
||||||
pub const fn text_title(bg: Color) -> TextStyle {
|
pub const fn text_title(bg: Color) -> TextStyle {
|
||||||
TextStyle::new(
|
TextStyle::new(
|
||||||
font::FONT_BOLD,
|
fonts::FONT_BOLD,
|
||||||
BLD_TITLE_COLOR,
|
BLD_TITLE_COLOR,
|
||||||
bg,
|
bg,
|
||||||
BLD_TITLE_COLOR,
|
BLD_TITLE_COLOR,
|
||||||
@ -211,28 +212,28 @@ pub const fn text_title(bg: Color) -> TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const TEXT_NORMAL: TextStyle =
|
pub const TEXT_NORMAL: TextStyle =
|
||||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
TextStyle::new(fonts::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||||
pub const TEXT_WARNING: TextStyle = TextStyle::new(
|
pub const TEXT_WARNING: TextStyle = TextStyle::new(
|
||||||
font::FONT_BOLD,
|
fonts::FONT_BOLD,
|
||||||
BLD_WARN_COLOR,
|
BLD_WARN_COLOR,
|
||||||
BLD_BG,
|
BLD_BG,
|
||||||
BLD_WARN_COLOR,
|
BLD_WARN_COLOR,
|
||||||
BLD_WARN_COLOR,
|
BLD_WARN_COLOR,
|
||||||
);
|
);
|
||||||
pub const fn text_fingerprint(bg: Color) -> TextStyle {
|
pub const fn text_fingerprint(bg: Color) -> TextStyle {
|
||||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, bg, BLD_FG, BLD_FG)
|
TextStyle::new(fonts::FONT_NORMAL, BLD_FG, bg, BLD_FG, BLD_FG)
|
||||||
.with_line_breaking(BreakWordsNoHyphen)
|
.with_line_breaking(BreakWordsNoHyphen)
|
||||||
}
|
}
|
||||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(font::FONT_BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
pub const TEXT_BOLD: TextStyle = TextStyle::new(fonts::FONT_BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||||
pub const TEXT_WIPE_BOLD: TextStyle = TextStyle::new(
|
pub const TEXT_WIPE_BOLD: TextStyle = TextStyle::new(
|
||||||
font::FONT_BOLD,
|
fonts::FONT_BOLD,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
BLD_WIPE_COLOR,
|
BLD_WIPE_COLOR,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
);
|
);
|
||||||
pub const TEXT_WIPE_NORMAL: TextStyle = TextStyle::new(
|
pub const TEXT_WIPE_NORMAL: TextStyle = TextStyle::new(
|
||||||
font::FONT_NORMAL,
|
fonts::FONT_NORMAL,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
BLD_WIPE_COLOR,
|
BLD_WIPE_COLOR,
|
||||||
BLD_WIPE_TEXT_COLOR,
|
BLD_WIPE_TEXT_COLOR,
|
||||||
|
@ -9,16 +9,16 @@ use crate::{
|
|||||||
text::{layout::Chunks, LineBreaking, PageBreaking, TextStyle},
|
text::{layout::Chunks, LineBreaking, PageBreaking, TextStyle},
|
||||||
FixedHeightBar,
|
FixedHeightBar,
|
||||||
},
|
},
|
||||||
display::{
|
display::Color,
|
||||||
font::{FONT_BIG, FONT_BOLD, FONT_DEMIBOLD, FONT_MONO, FONT_NORMAL, FONT_SUB},
|
|
||||||
Color,
|
|
||||||
},
|
|
||||||
geometry::{Insets, Offset},
|
geometry::{Insets, Offset},
|
||||||
util::include_icon,
|
util::include_icon,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::component::{ButtonStyle, ButtonStyleSheet, LoaderStyle, LoaderStyleSheet, ResultStyle};
|
use super::{
|
||||||
|
component::{ButtonStyle, ButtonStyleSheet, LoaderStyle, LoaderStyleSheet, ResultStyle},
|
||||||
|
fonts,
|
||||||
|
};
|
||||||
|
|
||||||
pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
||||||
|
|
||||||
@ -140,15 +140,27 @@ pub const fn label_default() -> TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard() -> TextStyle {
|
pub const fn label_keyboard() -> TextStyle {
|
||||||
TextStyle::new(FONT_DEMIBOLD, GREY_EXTRA_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(
|
||||||
|
fonts::FONT_DEMIBOLD,
|
||||||
|
GREY_EXTRA_LIGHT,
|
||||||
|
BG,
|
||||||
|
GREY_LIGHT,
|
||||||
|
GREY_LIGHT,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard_prompt() -> TextStyle {
|
pub const fn label_keyboard_prompt() -> TextStyle {
|
||||||
TextStyle::new(FONT_DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(fonts::FONT_DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard_warning() -> TextStyle {
|
pub const fn label_keyboard_warning() -> TextStyle {
|
||||||
TextStyle::new(FONT_DEMIBOLD, ORANGE_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(
|
||||||
|
fonts::FONT_DEMIBOLD,
|
||||||
|
ORANGE_LIGHT,
|
||||||
|
BG,
|
||||||
|
GREY_LIGHT,
|
||||||
|
GREY_LIGHT,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_keyboard_minor() -> TextStyle {
|
pub const fn label_keyboard_minor() -> TextStyle {
|
||||||
@ -177,7 +189,7 @@ pub const fn label_progress() -> TextStyle {
|
|||||||
|
|
||||||
pub const fn label_title_main() -> TextStyle {
|
pub const fn label_title_main() -> TextStyle {
|
||||||
TextStyle::new(
|
TextStyle::new(
|
||||||
FONT_NORMAL,
|
fonts::FONT_DEMIBOLD,
|
||||||
GREY_EXTRA_LIGHT,
|
GREY_EXTRA_LIGHT,
|
||||||
GREY_DARK,
|
GREY_DARK,
|
||||||
GREY_LIGHT,
|
GREY_LIGHT,
|
||||||
@ -186,35 +198,41 @@ pub const fn label_title_main() -> TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_title_danger() -> TextStyle {
|
pub const fn label_title_danger() -> TextStyle {
|
||||||
TextStyle::new(FONT_NORMAL, ORANGE_LIGHT, GREY_DARK, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(
|
||||||
|
fonts::FONT_DEMIBOLD,
|
||||||
|
ORANGE_LIGHT,
|
||||||
|
GREY_DARK,
|
||||||
|
GREY_LIGHT,
|
||||||
|
GREY_LIGHT,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_title_sub() -> TextStyle {
|
pub const fn label_title_sub() -> TextStyle {
|
||||||
TextStyle::new(FONT_SUB, GREY, GREY_DARK, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(fonts::FONT_SUB, GREY, GREY_DARK, GREY_LIGHT, GREY_LIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn label_coinjoin_progress() -> TextStyle {
|
pub const fn label_coinjoin_progress() -> TextStyle {
|
||||||
TextStyle::new(FONT_BOLD, FG, ORANGE_DIMMED, FG, FG)
|
TextStyle::new(fonts::FONT_DEMIBOLD, FG, ORANGE_DIMMED, FG, FG)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn button_default() -> ButtonStyleSheet {
|
pub const fn button_default() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREY,
|
icon_color: GREY,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_EXTRA_LIGHT,
|
text_color: GREY_EXTRA_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREY_EXTRA_LIGHT,
|
icon_color: GREY_EXTRA_LIGHT,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
@ -226,21 +244,21 @@ pub const fn button_default() -> ButtonStyleSheet {
|
|||||||
pub const fn button_warning_high() -> ButtonStyleSheet {
|
pub const fn button_warning_high() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_LIGHT,
|
text_color: ORANGE_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: ORANGE_DIMMED,
|
icon_color: ORANGE_DIMMED,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_LIGHT,
|
text_color: ORANGE_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: ORANGE_DIMMED,
|
icon_color: ORANGE_DIMMED,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_LIGHT,
|
text_color: ORANGE_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: ORANGE_DIMMED,
|
icon_color: ORANGE_DIMMED,
|
||||||
@ -252,21 +270,21 @@ pub const fn button_warning_high() -> ButtonStyleSheet {
|
|||||||
pub const fn button_warning_low() -> ButtonStyleSheet {
|
pub const fn button_warning_low() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
@ -279,14 +297,14 @@ pub const fn button_warning_low() -> ButtonStyleSheet {
|
|||||||
pub const fn button_confirm() -> ButtonStyleSheet {
|
pub const fn button_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREEN_LIME,
|
text_color: GREEN_LIME,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
background_color: GREEN_DARK,
|
background_color: GREEN_DARK,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREEN_LIME,
|
text_color: GREEN_LIME,
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_DARK,
|
icon_color: GREEN_DARK,
|
||||||
@ -294,7 +312,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -306,14 +324,14 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_cancel() -> ButtonStyleSheet {
|
pub const fn button_cancel() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_LIGHT,
|
text_color: ORANGE_LIGHT,
|
||||||
button_color: ORANGE_DARK,
|
button_color: ORANGE_DARK,
|
||||||
icon_color: ORANGE_LIGHT,
|
icon_color: ORANGE_LIGHT,
|
||||||
background_color: GREEN_DARK,
|
background_color: GREEN_DARK,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_DARK,
|
text_color: ORANGE_DARK,
|
||||||
button_color: ORANGE_LIGHT,
|
button_color: ORANGE_LIGHT,
|
||||||
icon_color: ORANGE_DARK,
|
icon_color: ORANGE_DARK,
|
||||||
@ -321,7 +339,7 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -333,21 +351,21 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
|||||||
pub const fn button_danger() -> ButtonStyleSheet {
|
pub const fn button_danger() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_LIGHT,
|
text_color: ORANGE_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: ORANGE_DIMMED,
|
icon_color: ORANGE_DIMMED,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_LIGHT,
|
text_color: ORANGE_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: ORANGE_LIGHT,
|
icon_color: ORANGE_LIGHT,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: ORANGE_LIGHT,
|
text_color: ORANGE_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: ORANGE_LIGHT,
|
icon_color: ORANGE_LIGHT,
|
||||||
@ -360,21 +378,21 @@ pub const fn button_danger() -> ButtonStyleSheet {
|
|||||||
pub const fn button_keyboard() -> ButtonStyleSheet {
|
pub const fn button_keyboard() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_NORMAL,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_EXTRA_DARK,
|
button_color: GREY_EXTRA_DARK,
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_NORMAL,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: GREY_LIGHT,
|
button_color: GREY_LIGHT,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_NORMAL,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_DARK,
|
text_color: GREY_DARK,
|
||||||
button_color: BG, // so there is no "button" itself, just the text
|
button_color: BG, // so there is no "button" itself, just the text
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
@ -386,14 +404,14 @@ pub const fn button_keyboard() -> ButtonStyleSheet {
|
|||||||
pub const fn button_keyboard_cancel() -> ButtonStyleSheet {
|
pub const fn button_keyboard_cancel() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BG, // TODO: gradient
|
button_color: BG, // TODO: gradient
|
||||||
icon_color: ORANGE_LIGHT,
|
icon_color: ORANGE_LIGHT,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: ORANGE_LIGHT,
|
button_color: ORANGE_LIGHT,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -401,7 +419,7 @@ pub const fn button_keyboard_cancel() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREEN_LIGHT,
|
icon_color: GREEN_LIGHT,
|
||||||
@ -413,14 +431,14 @@ pub const fn button_keyboard_cancel() -> ButtonStyleSheet {
|
|||||||
pub const fn button_keyboard_erase() -> ButtonStyleSheet {
|
pub const fn button_keyboard_erase() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BG, // TODO: gradient
|
button_color: BG, // TODO: gradient
|
||||||
icon_color: GREY,
|
icon_color: GREY,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREY_LIGHT,
|
button_color: GREY_LIGHT,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -428,7 +446,7 @@ pub const fn button_keyboard_erase() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREEN_LIGHT,
|
icon_color: GREEN_LIGHT,
|
||||||
@ -442,21 +460,21 @@ pub const fn button_keyboard_erase() -> ButtonStyleSheet {
|
|||||||
pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN_DARK,
|
button_color: GREEN_DARK,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: FG,
|
text_color: FG,
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_DARK,
|
icon_color: GREEN_DARK,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: GREY_DARK,
|
text_color: GREY_DARK,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREY_DARK,
|
icon_color: GREY_DARK,
|
||||||
@ -468,14 +486,14 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_passphrase_confirm() -> ButtonStyleSheet {
|
pub const fn button_passphrase_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREEN_LIME,
|
text_color: GREEN_LIME,
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
background_color: GREEN_DARK,
|
background_color: GREEN_DARK,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREEN_LIME,
|
text_color: GREEN_LIME,
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_DARK,
|
icon_color: GREEN_DARK,
|
||||||
@ -483,7 +501,7 @@ pub const fn button_passphrase_confirm() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -495,14 +513,14 @@ pub const fn button_passphrase_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_passphrase_confirm_empty() -> ButtonStyleSheet {
|
pub const fn button_passphrase_confirm_empty() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY,
|
text_color: GREY,
|
||||||
button_color: GREY_EXTRA_DARK,
|
button_color: GREY_EXTRA_DARK,
|
||||||
icon_color: GREY,
|
icon_color: GREY,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: GREY_LIGHT,
|
button_color: GREY_LIGHT,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -510,7 +528,7 @@ pub const fn button_passphrase_confirm_empty() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -522,14 +540,14 @@ pub const fn button_passphrase_confirm_empty() -> ButtonStyleSheet {
|
|||||||
pub const fn button_passphrase_next() -> ButtonStyleSheet {
|
pub const fn button_passphrase_next() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG, // TODO: gradient
|
button_color: BG, // TODO: gradient
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG, // TODO: gradient
|
button_color: BG, // TODO: gradient
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
@ -537,7 +555,7 @@ pub const fn button_passphrase_next() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
@ -549,14 +567,14 @@ pub const fn button_passphrase_next() -> ButtonStyleSheet {
|
|||||||
pub const fn button_recovery_confirm() -> ButtonStyleSheet {
|
pub const fn button_recovery_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREEN_LIME,
|
text_color: GREEN_LIME,
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
background_color: GREEN_DARK,
|
background_color: GREEN_DARK,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREEN_DARK,
|
text_color: GREEN_DARK,
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_DARK,
|
icon_color: GREEN_DARK,
|
||||||
@ -564,7 +582,7 @@ pub const fn button_recovery_confirm() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// used in SLIP-39 recovery for "*"
|
// used in SLIP-39 recovery for "*"
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -576,14 +594,14 @@ pub const fn button_recovery_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT, // difference
|
text_color: GREY_LIGHT, // difference
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_LIME,
|
icon_color: GREEN_LIME,
|
||||||
background_color: GREEN_DARK,
|
background_color: GREEN_DARK,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREEN_LIME,
|
text_color: GREEN_LIME,
|
||||||
button_color: GREEN_LIGHT,
|
button_color: GREEN_LIGHT,
|
||||||
icon_color: GREEN_DARK,
|
icon_color: GREEN_DARK,
|
||||||
@ -591,7 +609,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -603,14 +621,14 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
|||||||
pub const fn button_recovery_autocomplete() -> ButtonStyleSheet {
|
pub const fn button_recovery_autocomplete() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
button_color: GREY_EXTRA_DARK,
|
button_color: GREY_EXTRA_DARK,
|
||||||
icon_color: GREY_LIGHT,
|
icon_color: GREY_LIGHT,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: FG,
|
button_color: FG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -618,7 +636,7 @@ pub const fn button_recovery_autocomplete() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -630,14 +648,14 @@ pub const fn button_recovery_autocomplete() -> ButtonStyleSheet {
|
|||||||
pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY,
|
text_color: GREY,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: FG,
|
button_color: FG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -645,7 +663,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
|||||||
},
|
},
|
||||||
// not used
|
// not used
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_MONO,
|
font: fonts::FONT_MONO,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
@ -657,21 +675,21 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
|||||||
pub const fn button_counter() -> ButtonStyleSheet {
|
pub const fn button_counter() -> ButtonStyleSheet {
|
||||||
ButtonStyleSheet {
|
ButtonStyleSheet {
|
||||||
normal: &ButtonStyle {
|
normal: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY,
|
text_color: GREY,
|
||||||
button_color: GREY_EXTRA_DARK,
|
button_color: GREY_EXTRA_DARK,
|
||||||
icon_color: GREY,
|
icon_color: GREY,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
active: &ButtonStyle {
|
active: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: BG,
|
text_color: BG,
|
||||||
button_color: GREY_LIGHT,
|
button_color: GREY_LIGHT,
|
||||||
icon_color: BG,
|
icon_color: BG,
|
||||||
background_color: BG,
|
background_color: BG,
|
||||||
},
|
},
|
||||||
disabled: &ButtonStyle {
|
disabled: &ButtonStyle {
|
||||||
font: FONT_DEMIBOLD,
|
font: fonts::FONT_DEMIBOLD,
|
||||||
text_color: GREY_DARK,
|
text_color: GREY_DARK,
|
||||||
button_color: BG,
|
button_color: BG,
|
||||||
icon_color: GREY_DARK,
|
icon_color: GREY_DARK,
|
||||||
@ -706,16 +724,19 @@ pub const fn loader_lock_icon() -> LoaderStyleSheet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const TEXT_SUPER: TextStyle = TextStyle::new(FONT_BIG, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
pub const TEXT_SUPER: TextStyle = TextStyle::new(fonts::FONT_BIG, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
||||||
pub const TEXT_MAIN_GREY_EXTRA_LIGHT: TextStyle =
|
pub const TEXT_MAIN_GREY_EXTRA_LIGHT: TextStyle =
|
||||||
TextStyle::new(FONT_NORMAL, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
TextStyle::new(fonts::FONT_DEMIBOLD, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
||||||
pub const TEXT_MAIN_GREY_LIGHT: TextStyle = TextStyle::new(FONT_NORMAL, GREY_LIGHT, BG, GREY, GREY);
|
pub const TEXT_MAIN_GREY_LIGHT: TextStyle =
|
||||||
pub const TEXT_SUB_GREY_LIGHT: TextStyle = TextStyle::new(FONT_SUB, GREY_LIGHT, BG, GREY, GREY);
|
TextStyle::new(fonts::FONT_DEMIBOLD, GREY_LIGHT, BG, GREY, GREY);
|
||||||
pub const TEXT_SUB_GREY: TextStyle = TextStyle::new(FONT_SUB, GREY, BG, GREY, GREY);
|
pub const TEXT_SUB_GREY_LIGHT: TextStyle =
|
||||||
|
TextStyle::new(fonts::FONT_SUB, GREY_LIGHT, BG, GREY, GREY);
|
||||||
|
pub const TEXT_SUB_GREY: TextStyle = TextStyle::new(fonts::FONT_SUB, GREY, BG, GREY, GREY);
|
||||||
pub const TEXT_SUB_GREEN_LIME: TextStyle =
|
pub const TEXT_SUB_GREEN_LIME: TextStyle =
|
||||||
TextStyle::new(FONT_SUB, GREEN_LIME, BG, GREEN_LIME, GREEN_LIME);
|
TextStyle::new(fonts::FONT_SUB, GREEN_LIME, BG, GREEN_LIME, GREEN_LIME);
|
||||||
pub const TEXT_WARNING: TextStyle = TextStyle::new(FONT_NORMAL, ORANGE_LIGHT, BG, GREY, GREY);
|
pub const TEXT_WARNING: TextStyle =
|
||||||
pub const TEXT_MONO: TextStyle = TextStyle::new(FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
|
TextStyle::new(fonts::FONT_DEMIBOLD, ORANGE_LIGHT, BG, GREY, GREY);
|
||||||
|
pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
|
||||||
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
||||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
||||||
@ -738,9 +759,12 @@ pub const TEXT_MONO_ADDRESS_CHUNKS_SMALLER_X_OFFSET: TextStyle = TEXT_MONO
|
|||||||
.with_ellipsis_icon(ICON_PAGE_NEXT, -12);
|
.with_ellipsis_icon(ICON_PAGE_NEXT, -12);
|
||||||
|
|
||||||
// TODO: remove TextStyles below when ui-t3t1 done
|
// TODO: remove TextStyles below when ui-t3t1 done
|
||||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
pub const TEXT_NORMAL: TextStyle =
|
||||||
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(FONT_BOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
pub const TEXT_DEMIBOLD: TextStyle =
|
||||||
|
TextStyle::new(fonts::FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
|
pub const TEXT_BOLD: TextStyle =
|
||||||
|
TextStyle::new(fonts::FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
|
|
||||||
/// Decide the text style of chunkified text according to its length.
|
/// Decide the text style of chunkified text according to its length.
|
||||||
pub fn get_chunkified_text_style(character_length: usize) -> &'static TextStyle {
|
pub fn get_chunkified_text_style(character_length: usize) -> &'static TextStyle {
|
||||||
@ -754,12 +778,17 @@ pub fn get_chunkified_text_style(character_length: usize) -> &'static TextStyle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const TEXT_NORMAL_GREY_EXTRA_LIGHT: TextStyle =
|
pub const TEXT_NORMAL_GREY_EXTRA_LIGHT: TextStyle = TextStyle::new(
|
||||||
TextStyle::new(FONT_NORMAL, GREY_EXTRA_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
fonts::FONT_DEMIBOLD,
|
||||||
pub const TEXT_CHECKLIST_DEFAULT: TextStyle = TextStyle::new(FONT_SUB, GREY, BG, GREY, GREY);
|
GREY_EXTRA_LIGHT,
|
||||||
|
BG,
|
||||||
|
GREY_LIGHT,
|
||||||
|
GREY_LIGHT,
|
||||||
|
);
|
||||||
|
pub const TEXT_CHECKLIST_DEFAULT: TextStyle = TextStyle::new(fonts::FONT_SUB, GREY, BG, GREY, GREY);
|
||||||
pub const TEXT_CHECKLIST_SELECTED: TextStyle =
|
pub const TEXT_CHECKLIST_SELECTED: TextStyle =
|
||||||
TextStyle::new(FONT_NORMAL, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(fonts::FONT_DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
pub const TEXT_CHECKLIST_DONE: TextStyle = TextStyle::new(FONT_SUB, GREY, BG, GREY, GREY);
|
pub const TEXT_CHECKLIST_DONE: TextStyle = TextStyle::new(fonts::FONT_SUB, GREY, BG, GREY, GREY);
|
||||||
|
|
||||||
/// Spacing between components (e.g. header and main content) and offsets from
|
/// Spacing between components (e.g. header and main content) and offsets from
|
||||||
/// the side of the screen. Generally applied everywhere except the top side of
|
/// the side of the screen. Generally applied everywhere except the top side of
|
||||||
|
@ -20,7 +20,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
Border, CachedJpeg, ComponentExt, Empty, FormattedText, Never, Timeout,
|
Border, CachedJpeg, ComponentExt, Empty, FormattedText, Never, Timeout,
|
||||||
},
|
},
|
||||||
geometry::{self, Direction},
|
geometry::{self, Direction, Offset},
|
||||||
layout::{
|
layout::{
|
||||||
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
|
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
|
||||||
util::{PropsList, RecoveryType},
|
util::{PropsList, RecoveryType},
|
||||||
@ -42,7 +42,7 @@ use super::{
|
|||||||
self, new_confirm_action_simple, ConfirmActionExtra, ConfirmActionMenuStrings,
|
self, new_confirm_action_simple, ConfirmActionExtra, ConfirmActionMenuStrings,
|
||||||
ConfirmActionStrings, ConfirmValue, ShowInfoParams,
|
ConfirmActionStrings, ConfirmValue, ShowInfoParams,
|
||||||
},
|
},
|
||||||
theme, UIDelizia,
|
fonts, theme, UIDelizia,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl FirmwareUI for UIDelizia {
|
impl FirmwareUI for UIDelizia {
|
||||||
@ -223,14 +223,14 @@ impl FirmwareUI for UIDelizia {
|
|||||||
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
|
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
|
||||||
for item in IterBuf::new().try_iterate(items)? {
|
for item in IterBuf::new().try_iterate(items)? {
|
||||||
if item.is_str() {
|
if item.is_str() {
|
||||||
ops = ops.text_normal(TString::try_from(item)?)
|
ops = ops.text(TString::try_from(item)?, fonts::FONT_NORMAL)
|
||||||
} else {
|
} else {
|
||||||
let [emphasis, text]: [Obj; 2] = util::iter_into_array(item)?;
|
let [emphasis, text]: [Obj; 2] = util::iter_into_array(item)?;
|
||||||
let text: TString = text.try_into()?;
|
let text: TString = text.try_into()?;
|
||||||
if emphasis.try_into()? {
|
if emphasis.try_into()? {
|
||||||
ops = ops.text_demibold(text);
|
ops = ops.text(text, fonts::FONT_DEMIBOLD);
|
||||||
} else {
|
} else {
|
||||||
ops = ops.text_normal(text);
|
ops = ops.text(text, fonts::FONT_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -803,7 +803,11 @@ impl FirmwareUI for UIDelizia {
|
|||||||
.with_spacing(theme::CHECKLIST_SPACING),
|
.with_spacing(theme::CHECKLIST_SPACING),
|
||||||
)
|
)
|
||||||
.with_check_width(theme::CHECKLIST_CHECK_WIDTH)
|
.with_check_width(theme::CHECKLIST_CHECK_WIDTH)
|
||||||
.with_numerals()
|
.with_numerals(fonts::FONT_SUB)
|
||||||
|
.with_numeral_offset(Offset::new(
|
||||||
|
4,
|
||||||
|
fonts::FONT_DEMIBOLD.visible_text_height("1"),
|
||||||
|
))
|
||||||
.with_icon_done_color(theme::GREEN)
|
.with_icon_done_color(theme::GREEN)
|
||||||
.with_done_offset(theme::CHECKLIST_DONE_OFFSET);
|
.with_done_offset(theme::CHECKLIST_DONE_OFFSET);
|
||||||
|
|
||||||
@ -1068,7 +1072,12 @@ impl FirmwareUI for UIDelizia {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
|
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
let layout = RootComponent::new(Connect::new(text, theme::FG, theme::BG));
|
let layout = RootComponent::new(Connect::new(
|
||||||
|
text,
|
||||||
|
fonts::FONT_DEMIBOLD,
|
||||||
|
theme::FG,
|
||||||
|
theme::BG,
|
||||||
|
));
|
||||||
Ok(layout)
|
Ok(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
display::{font::FONT_NORMAL, Color, Font},
|
display::{Color, Font},
|
||||||
geometry::{Alignment, Offset, Point, Rect},
|
geometry::{Alignment, Offset, Point, Rect},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -28,13 +28,13 @@ pub struct Text<'a> {
|
|||||||
impl<'a> Text<'a> {
|
impl<'a> Text<'a> {
|
||||||
/// Creates a `shape::Text` structure with a specified
|
/// Creates a `shape::Text` structure with a specified
|
||||||
/// text (`str`) and the bottom-left corner (`pos`).
|
/// text (`str`) and the bottom-left corner (`pos`).
|
||||||
pub fn new(pos: Point, text: &'a str) -> Self {
|
pub fn new(pos: Point, text: &'a str, font: Font) -> Self {
|
||||||
Self {
|
Self {
|
||||||
pos,
|
pos,
|
||||||
text,
|
text,
|
||||||
color: Color::white(),
|
color: Color::white(),
|
||||||
alpha: 255,
|
alpha: 255,
|
||||||
font: FONT_NORMAL,
|
font,
|
||||||
align: Alignment::Start,
|
align: Alignment::Start,
|
||||||
bounds: Rect::zero(),
|
bounds: Rect::zero(),
|
||||||
}
|
}
|
||||||
@ -44,10 +44,6 @@ impl<'a> Text<'a> {
|
|||||||
Self { color, ..self }
|
Self { color, ..self }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_font(self, font: Font) -> Self {
|
|
||||||
Self { font, ..self }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_align(self, align: Alignment) -> Self {
|
pub fn with_align(self, align: Alignment) -> Self {
|
||||||
Self { align, ..self }
|
Self { align, ..self }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user