Use theme text methods instead of hard coded colors

This commit is contained in:
edouardparis 2025-02-04 15:46:10 +01:00
parent 3a4df7aeec
commit dc5b57c859
17 changed files with 294 additions and 201 deletions

View File

@ -3,7 +3,6 @@ use std::collections::HashMap;
use iced::{widget::Space, Alignment, Length};
use liana_ui::{
color,
component::{amount::*, badge, button, form, text::*},
icon, theme,
widget::*,
@ -84,7 +83,8 @@ fn coin_list_view<'a>(
// It is not possible to know if a coin is a
// change coin or not so for now, From is
// enough
p1_regular("From").color(color::GREY_3),
p1_regular("From")
.style(theme::text::secondary),
)
.push(p1_regular(label)),
)
@ -101,7 +101,8 @@ fn coin_list_view<'a>(
// It is not possible to know if a coin is a
// change coin or not so for now, From is
// enough
p1_regular("From").color(color::GREY_3),
p1_regular("From")
.style(theme::text::secondary),
)
.push(p1_regular(label)),
)
@ -156,7 +157,7 @@ fn coin_list_view<'a>(
if blockheight > b as u32 + timelock as u32 {
Some(Container::new(
p1_bold("One of the recovery path is available")
.color(color::RED),
.style(theme::text::error),
))
} else {
Some(Container::new(p1_bold(format!(
@ -178,25 +179,29 @@ fn coin_list_view<'a>(
.push(
p2_regular("Address label:")
.bold()
.color(color::GREY_2),
.style(theme::text::secondary),
)
.push(if let Some(label) = labels.get(&address) {
p2_regular(label).color(color::GREY_2)
p2_regular(label).style(theme::text::secondary)
} else {
p2_regular("No label").color(color::GREY_2)
p2_regular("No label").style(theme::text::secondary)
})
.spacing(5),
)
.push(
Row::new()
.align_y(Alignment::Center)
.push(p2_regular("Address:").bold().color(color::GREY_2))
.push(
p2_regular("Address:")
.bold()
.style(theme::text::secondary),
)
.push(
Row::new()
.align_y(Alignment::Center)
.push(
p2_regular(address.clone())
.color(color::GREY_2),
.style(theme::text::secondary),
)
.push(
Button::new(icon::clipboard_icon())
@ -214,25 +219,29 @@ fn coin_list_view<'a>(
.push(
p2_regular("Deposit transaction label:")
.bold()
.color(color::GREY_2),
.style(theme::text::secondary),
)
.push(if let Some(label) = labels.get(&txid) {
p2_regular(label).color(color::GREY_2)
p2_regular(label).style(theme::text::secondary)
} else {
p2_regular("No label").color(color::GREY_2)
p2_regular("No label").style(theme::text::secondary)
})
.spacing(5),
)
.push(
Row::new()
.align_y(Alignment::Center)
.push(p2_regular("Outpoint:").bold().color(color::GREY_2))
.push(
p2_regular("Outpoint:")
.bold()
.style(theme::text::secondary),
)
.push(
Row::new()
.align_y(Alignment::Center)
.push(
p2_regular(format!("{}", coin.outpoint))
.color(color::GREY_2),
.style(theme::text::secondary),
)
.push(
Button::new(icon::clipboard_icon())
@ -247,9 +256,14 @@ fn coin_list_view<'a>(
.push_maybe(coin.block_height.map(|b| {
Row::new()
.push(
p2_regular("Block height:").bold().color(color::GREY_2),
p2_regular("Block height:")
.bold()
.style(theme::text::secondary),
)
.push(
p2_regular(format!("{}", b))
.style(theme::text::secondary),
)
.push(p2_regular(format!("{}", b)).color(color::GREY_2))
.spacing(5)
})),
)
@ -257,7 +271,11 @@ fn coin_list_view<'a>(
Column::new()
.push(
Row::new()
.push(p2_regular("Spend txid:").bold().color(color::GREY_2))
.push(
p2_regular("Spend txid:")
.bold()
.style(theme::text::secondary),
)
.push(p2_regular(format!("{}", info.txid)))
.spacing(5),
)
@ -266,13 +284,15 @@ fn coin_list_view<'a>(
.push(
p2_regular("Spend block height:")
.bold()
.color(color::GREY_2),
.style(theme::text::secondary),
)
.push(p2_regular(format!("{}", height)))
.spacing(5)
} else {
Row::new().push(
p2_regular("Not in a block").bold().color(color::GREY_2),
p2_regular("Not in a block")
.bold()
.style(theme::text::secondary),
)
})
.spacing(5)
@ -320,7 +340,7 @@ pub fn coin_sequence_label<'a, T: 'a>(seq: u32, timelock: u32) -> Container<'a,
Row::new()
.spacing(5)
.push(icon::clock_icon().width(Length::Fixed(20.0)))
.push(p2_regular(expire_message(seq)).color(color::GREY_3))
.push(p2_regular(expire_message(seq)).style(theme::text::secondary))
.align_y(Alignment::Center),
)
.padding(10)

View File

@ -69,13 +69,13 @@ pub fn home_view<'a>(
SyncStatus::WalletFullScan => text("Syncing"),
_ => text("Checking for new transactions"),
}
.color(color::GREY_2),
.style(theme::text::secondary),
)
.push(spinner::typing_text_carousel(
"...",
true,
Duration::from_millis(2000),
|content| text(content).color(color::GREY_2),
|content| text(content).style(theme::text::secondary),
)),
)
} else {
@ -86,9 +86,13 @@ pub fn home_view<'a>(
Some(
Row::new()
.spacing(10)
.push(text("+").size(H3_SIZE).color(color::GREY_3))
.push(text("+").size(H3_SIZE).style(theme::text::secondary))
.push(unconfirmed_amount_with_size(unconfirmed_balance, H3_SIZE))
.push(text("unconfirmed").size(H3_SIZE).color(color::GREY_3)),
.push(
text("unconfirmed")
.size(H3_SIZE)
.style(theme::text::secondary),
),
)
} else {
None
@ -111,7 +115,7 @@ pub fn home_view<'a>(
.push(
icon::tooltip_icon()
.size(20)
.color(color::GREY_3)
.style(theme::text::secondary)
.width(Length::Fixed(20.0)),
)
.width(Length::Fill),
@ -190,10 +194,9 @@ fn event_list_view(event: &Payment) -> Element<'_, Message> {
let label = if let Some(label) = &event.label {
Some(p1_regular(label))
} else {
event
.address_label
.as_ref()
.map(|label| p1_regular(format!("address label: {}", label)).color(color::GREY_3))
event.address_label.as_ref().map(|label| {
p1_regular(format!("address label: {}", label)).style(theme::text::secondary)
})
};
if event.kind == PaymentKind::Incoming {
if let Some(t) = event.time {
@ -298,7 +301,7 @@ pub fn payment_view<'a>(
.push_maybe(tx.fee_amount.map(|fee_amount| {
Row::new()
.align_y(Alignment::Center)
.push(h3("Miner fee: ").color(color::GREY_3))
.push(h3("Miner fee: ").style(theme::text::secondary))
.push(amount_with_size(&fee_amount, H3_SIZE))
.push(text(" ").size(H3_SIZE))
.push(
@ -307,7 +310,7 @@ pub fn payment_view<'a>(
fee_amount.to_sat() / tx.tx.vsize() as u64
))
.size(H4_SIZE)
.color(color::GREY_3),
.style(theme::text::secondary),
)
}))
.push(card::simple(

View File

@ -14,7 +14,6 @@ use liana::{
};
use liana_ui::{
color,
component::{
amount::*,
badge, button, card,
@ -202,7 +201,8 @@ pub fn broadcast_action<'a>(
.push(text(txid.to_string()))
.push(
Button::new(
icon::clipboard_icon().color(color::GREY_3),
icon::clipboard_icon()
.style(theme::text::secondary),
)
.on_press(Message::Clipboard(txid.to_string()))
.style(theme::button::transparent_border),
@ -297,7 +297,7 @@ pub fn spend_header<'a>(
.push(
Row::new()
.align_y(Alignment::Center)
.push(h3("Miner fee: ").color(color::GREY_3))
.push(h3("Miner fee: ").style(theme::text::secondary))
.push_maybe(if tx.fee_amount.is_none() {
Some(text("Missing information about transaction inputs"))
} else {
@ -308,7 +308,7 @@ pub fn spend_header<'a>(
.push_maybe(tx.min_feerate_vb().map(|rate| {
text(format!("(~{} sats/vbyte)", &rate))
.size(H4_SIZE)
.color(color::GREY_3)
.style(theme::text::secondary)
})),
),
)
@ -358,14 +358,16 @@ pub fn spend_overview_view<'a>(
.push(p1_bold("Tx ID").width(Length::Fill))
.push(
p2_regular(tx.psbt.unsigned_tx.compute_txid().to_string())
.color(color::GREY_3),
.style(theme::text::secondary),
)
.push(
Button::new(icon::clipboard_icon().color(color::GREY_3))
.on_press(Message::Clipboard(
tx.psbt.unsigned_tx.compute_txid().to_string(),
))
.style(theme::button::transparent_border),
Button::new(
icon::clipboard_icon().style(theme::text::secondary),
)
.on_press(Message::Clipboard(
tx.psbt.unsigned_tx.compute_txid().to_string(),
))
.style(theme::button::transparent_border),
)
.align_y(Alignment::Center),
),
@ -414,8 +416,8 @@ pub fn signatures<'a>(
.align_y(Alignment::Center)
.spacing(10)
.push(p1_bold("Status"))
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Ready").bold().color(color::GREEN))
.push(icon::circle_check_icon().style(theme::text::success))
.push(text("Ready").bold().style(theme::text::success))
.push(text(" signed by"))
.push(sigs.signed_pubkeys.keys().fold(
Row::new().spacing(5),
@ -453,8 +455,8 @@ pub fn signatures<'a>(
Row::new()
.spacing(5)
.align_y(Alignment::Center)
.push(icon::circle_cross_icon().color(color::RED))
.push(text("Not ready").color(color::RED))
.push(icon::circle_cross_icon().style(theme::text::error))
.push(text("Not ready").style(theme::text::error))
.width(Length::Fill),
)
.push(icon::collapse_icon()),
@ -473,8 +475,8 @@ pub fn signatures<'a>(
Row::new()
.spacing(5)
.align_y(Alignment::Center)
.push(icon::circle_cross_icon().color(color::RED))
.push(text("Not ready").color(color::RED))
.push(icon::circle_cross_icon().style(theme::text::error))
.push(text("Not ready").style(theme::text::error))
.width(Length::Fill),
)
.push(icon::collapsed_icon()),
@ -566,9 +568,9 @@ pub fn path_view<'a>(
.push(
Row::new()
.push(if missing_signatures == 0 {
icon::circle_check_icon().color(color::GREEN)
icon::circle_check_icon().style(theme::text::success)
} else {
icon::circle_cross_icon().color(color::GREY_3)
icon::circle_cross_icon().style(theme::text::secondary)
})
.push(Space::with_width(Length::Fixed(20.0))),
)
@ -584,12 +586,12 @@ pub fn path_view<'a>(
" from "
}
))
.color(color::GREY_3),
.style(theme::text::secondary),
)
.push_maybe(row_unsigned)
.push_maybe(
(!sigs.signed_pubkeys.is_empty())
.then_some(p1_regular(", already signed by ").color(color::GREY_3)),
.then_some(p1_regular(", already signed by ").style(theme::text::secondary)),
)
.push(row_signed),
)
@ -849,10 +851,10 @@ fn input_view<'a>(
Row::new()
.align_y(Alignment::Center)
.spacing(5)
.push(p1_bold("Outpoint:").color(color::GREY_3))
.push(p2_regular(outpoint.clone()).color(color::GREY_3))
.push(p1_bold("Outpoint:").style(theme::text::secondary))
.push(p2_regular(outpoint.clone()).style(theme::text::secondary))
.push(
Button::new(icon::clipboard_icon().color(color::GREY_3))
Button::new(icon::clipboard_icon().style(theme::text::secondary))
.on_press(Message::Clipboard(outpoint.clone()))
.style(theme::button::transparent_border),
),
@ -867,12 +869,14 @@ fn input_view<'a>(
.align_y(Alignment::Center)
.width(Length::Fill)
.spacing(5)
.push(p1_bold("Address:").color(color::GREY_3))
.push(p2_regular(addr.clone()).color(color::GREY_3))
.push(p1_bold("Address:").style(theme::text::secondary))
.push(p2_regular(addr.clone()).style(theme::text::secondary))
.push(
Button::new(icon::clipboard_icon().color(color::GREY_3))
.on_press(Message::Clipboard(addr))
.style(theme::button::transparent_border),
Button::new(
icon::clipboard_icon().style(theme::text::secondary),
)
.on_press(Message::Clipboard(addr))
.style(theme::button::transparent_border),
),
)
}))
@ -886,8 +890,8 @@ fn input_view<'a>(
.align_y(Alignment::Center)
.width(Length::Fill)
.spacing(5)
.push(p1_bold("Address label:").color(color::GREY_3))
.push(p2_regular(label).color(color::GREY_3)),
.push(p1_bold("Address label:").style(theme::text::secondary))
.push(p2_regular(label).style(theme::text::secondary)),
)
})
})),
@ -948,12 +952,14 @@ fn payment_view<'a>(
.align_y(Alignment::Center)
.width(Length::Fill)
.spacing(5)
.push(p1_bold("Address:").color(color::GREY_3))
.push(p2_regular(addr.clone()).color(color::GREY_3))
.push(p1_bold("Address:").style(theme::text::secondary))
.push(p2_regular(addr.clone()).style(theme::text::secondary))
.push(
Button::new(icon::clipboard_icon().color(color::GREY_3))
.on_press(Message::Clipboard(addr.clone()))
.style(theme::button::transparent_border),
Button::new(
icon::clipboard_icon().style(theme::text::secondary),
)
.on_press(Message::Clipboard(addr.clone()))
.style(theme::button::transparent_border),
),
),
)
@ -966,8 +972,8 @@ fn payment_view<'a>(
.align_y(Alignment::Center)
.width(Length::Fill)
.spacing(5)
.push(p1_bold("Address label:").color(color::GREY_3))
.push(p2_regular(label).color(color::GREY_3)),
.push(p1_bold("Address label:").style(theme::text::secondary))
.push(p2_regular(label).style(theme::text::secondary)),
)
}))
}))
@ -995,10 +1001,10 @@ fn change_view(output: &TxOut, network: Network) -> Element<Message> {
.align_y(Alignment::Center)
.width(Length::Fill)
.spacing(5)
.push(p1_bold("Address:").color(color::GREY_3))
.push(p2_regular(addr.clone()).color(color::GREY_3))
.push(p1_bold("Address:").style(theme::text::secondary))
.push(p2_regular(addr.clone()).style(theme::text::secondary))
.push(
Button::new(icon::clipboard_icon().color(color::GREY_3))
Button::new(icon::clipboard_icon().style(theme::text::secondary))
.on_press(Message::Clipboard(addr))
.style(theme::button::transparent_border),
),
@ -1165,7 +1171,7 @@ pub fn update_spend_success_view<'a>() -> Element<'a, Message> {
Column::new()
.push(
card::simple(Container::new(
text("Spend transaction is updated").color(color::GREEN),
text("Spend transaction is updated").style(theme::text::secondary),
))
.padding(50),
)

View File

@ -1,7 +1,6 @@
use iced::{widget::Space, Alignment, Length};
use liana_ui::{
color,
component::{amount::*, badge, button, card, form, text::*},
icon, theme,
widget::*,
@ -51,7 +50,10 @@ pub fn import_psbt_view<'a>(
pub fn import_psbt_success_view<'a>() -> Element<'a, Message> {
Column::new()
.push(
card::simple(Container::new(text("PSBT is imported").color(color::GREEN))).padding(50),
card::simple(Container::new(
text("PSBT is imported").style(theme::text::success),
))
.padding(50),
)
.width(Length::Fixed(400.0))
.align_x(Alignment::Center)
@ -118,9 +120,9 @@ fn spend_tx_list_view(i: usize, tx: &SpendTx) -> Element<'_, Message> {
},
sigs.threshold
))
.color(color::GREY_3),
.style(theme::text::secondary),
)
.push(icon::key_icon().color(color::GREY_3)),
.push(icon::key_icon().style(theme::text::secondary)),
)
})
.push_maybe(

View File

@ -15,7 +15,6 @@ use liana::miniscript::bitcoin::{
};
use liana_ui::{
color,
component::{
button, card, form,
text::{self, *},
@ -85,7 +84,7 @@ pub fn receive<'a>(
.push(
p2_regular(addr)
.small()
.color(color::GREY_3),
.style(theme::text::secondary),
)
// Space between the address and the scrollbar
.push(Space::with_height(
@ -102,7 +101,8 @@ pub fn receive<'a>(
)
.push(
Button::new(
icon::clipboard_icon().color(color::GREY_3),
icon::clipboard_icon()
.style(theme::text::secondary),
)
.on_press(Message::Clipboard(address.to_string()))
.style(theme::button::transparent_border),

View File

@ -16,7 +16,6 @@ use lianad::config::BitcoindRpcAuth;
use super::{dashboard, message::*};
use liana_ui::{
color,
component::{badge, button, card, form, separation, text::*, tooltip::tooltip},
icon, theme,
widget::*,
@ -279,7 +278,7 @@ pub fn remote_backend_section<'a>(
.push(
Row::new()
.push_maybe(if success {
Some(text("Invitation was sent").color(color::GREEN))
Some(text("Invitation was sent").style(theme::text::success))
} else {
None
})
@ -747,15 +746,15 @@ pub fn is_running_label<'a, T: 'a>(is_running: Option<bool>) -> Container<'a, T>
if running {
Container::new(
Row::new()
.push(icon::dot_icon().size(5).color(color::GREEN))
.push(text("Running").small().color(color::GREEN))
.push(icon::dot_icon().size(5).style(theme::text::success))
.push(text("Running").small().style(theme::text::success))
.align_y(Alignment::Center),
)
} else {
Container::new(
Row::new()
.push(icon::dot_icon().size(5).color(color::RED))
.push(text("Not running").small().color(color::RED))
.push(icon::dot_icon().size(5).style(theme::text::error))
.push(text("Not running").small().style(theme::text::error))
.align_y(Alignment::Center),
)
}
@ -784,7 +783,10 @@ pub fn rescan<'a>(
.push(badge::badge(icon::block_icon()))
.push(text("Blockchain rescan").bold().width(Length::Fill))
.push_maybe(if success {
Some(text("Successfully rescanned the blockchain").color(color::GREEN))
Some(
text("Successfully rescanned the blockchain")
.style(theme::text::success),
)
} else {
None
})
@ -834,20 +836,23 @@ pub fn rescan<'a>(
.spacing(10),
)
.push_maybe(if invalid_date {
Some(p1_regular("Provided date is invalid").color(color::RED))
Some(p1_regular("Provided date is invalid").style(theme::text::error))
} else {
None
})
.push_maybe(if past_possible_height {
Some(
p1_regular("Provided date earlier than the node prune height")
.color(color::RED),
.style(theme::text::error),
)
} else {
None
})
.push_maybe(if future_date {
Some(p1_regular("Provided date is in the future").color(color::RED))
Some(
p1_regular("Provided date is in the future")
.style(theme::text::error),
)
} else {
None
})
@ -1000,8 +1005,11 @@ pub fn wallet_settings<'a>(
Some(
Row::new()
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Updated").color(color::GREEN)),
.push(
icon::circle_check_icon()
.style(theme::text::success),
)
.push(text("Updated").style(theme::text::success)),
)
} else {
None

View File

@ -12,7 +12,6 @@ use liana::{
};
use liana_ui::{
color,
component::{amount::*, badge, button, form, text::*},
icon, theme,
widget::*,
@ -57,8 +56,8 @@ pub fn spend_view<'a>(
col.push(
Row::new()
.spacing(5)
.push(icon::warning_icon().color(color::ORANGE))
.push(text(warning).color(color::ORANGE)),
.push(icon::warning_icon().style(theme::text::warning))
.push(text(warning).style(theme::text::warning)),
)
},
))
@ -154,7 +153,7 @@ pub fn create_spend_tx<'a>(
Some(
Container::new(
text("Two payment addresses are the same")
.color(color::RED),
.style(theme::text::warning),
)
.padding(10),
)
@ -226,7 +225,7 @@ pub fn create_spend_tx<'a>(
),
P2_SIZE,
))
.push(p2_regular("selected").color(color::GREY_3))
.push(p2_regular("selected").style(theme::text::secondary))
} else if let Some(amount_left) = amount_left {
if amount_left.to_sat() == 0 && !is_valid {
// If amount left is set, the current configuration must be redraftable.
@ -237,20 +236,23 @@ pub fn create_spend_tx<'a>(
// and it has the max selected.
Row::new().push(
text("Select at least one coin.")
.color(color::GREY_3),
.style(theme::text::secondary),
)
} else {
// There must be a recipient with max selected and value 0.
Row::new().push(
text("Check max amount for recipient.")
.color(color::GREY_3),
.style(theme::text::secondary),
)
}
} else {
Row::new()
.spacing(5)
.push(amount_with_size(amount_left, P2_SIZE))
.push(p2_regular("left to select").color(color::GREY_3))
.push(
p2_regular("left to select")
.style(theme::text::secondary),
)
}
} else {
Row::new().push(
@ -259,7 +261,7 @@ pub fn create_spend_tx<'a>(
} else {
"Add recipient details."
})
.color(color::GREY_3),
.style(theme::text::secondary),
)
})
.width(Length::Fill),
@ -384,9 +386,11 @@ pub fn recipient_view<'a>(
.map(amount_as_string)
.unwrap_or(amount.value.clone());
Some(
Container::new(text(amount_txt).size(P1_SIZE).color(color::GREY_2))
.padding(10)
.width(Length::Fill),
Container::new(
text(amount_txt).size(P1_SIZE).style(theme::text::secondary),
)
.padding(10)
.width(Length::Fill),
)
} else {
None
@ -445,7 +449,7 @@ fn coin_list_view<'a>(
// It is not possible to know if a coin is a
// change coin or not so for now, From is
// enough
p1_regular("From").color(color::GREY_3),
p1_regular("From").style(theme::text::secondary),
)
.push(p1_regular(label)),
)

View File

@ -8,7 +8,6 @@ use iced::{
};
use liana_ui::{
color,
component::{amount::*, badge, button, card, form, text::*},
icon, theme,
widget::*,
@ -121,7 +120,7 @@ fn tx_list_view(i: usize, tx: &HistoryTransaction) -> Element<'_, Message> {
.format("%b. %d, %Y - %T")
.to_string(),
)
.color(color::GREY_3)
.style(theme::text::secondary)
.small(),
)
})),
@ -238,9 +237,11 @@ pub fn create_rbf_modal<'a>(
.align_y(Alignment::Center)
.push(text(txid.to_string()))
.push(
Button::new(icon::clipboard_icon().color(color::GREY_3))
.on_press(Message::Clipboard(txid.to_string()))
.style(theme::button::transparent_border),
Button::new(
icon::clipboard_icon().style(theme::text::secondary),
)
.on_press(Message::Clipboard(txid.to_string()))
.style(theme::button::transparent_border),
),
)
},
@ -275,10 +276,10 @@ pub fn create_rbf_modal<'a>(
Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(icon::circle_check_icon().style(theme::text::secondary))
.push(
text("Replacement PSBT created successfully and ready to be signed")
.color(color::GREEN),
.style(theme::text::success),
)
}))
.push_maybe(replacement_txid.map(|id| {
@ -343,7 +344,7 @@ pub fn tx_view<'a>(
.push_maybe(tx.fee_amount.map(|fee_amount| {
Row::new()
.align_y(Alignment::Center)
.push(h3("Miner fee: ").color(color::GREY_3))
.push(h3("Miner fee: ").style(theme::text::secondary))
.push(amount_with_size(&fee_amount, H3_SIZE))
.push(text(" ").size(H3_SIZE))
.push(
@ -352,7 +353,7 @@ pub fn tx_view<'a>(
fee_amount.to_sat() / tx.tx.vsize() as u64
))
.size(H4_SIZE)
.color(color::GREY_3),
.style(theme::text::secondary),
)
})),
),

View File

@ -14,7 +14,6 @@ use std::str::FromStr;
use liana::miniscript::bitcoin::{self, bip32::Fingerprint};
use liana_ui::{
color,
component::{
button, card, form, hw, separation,
text::{p1_regular, text, Text},
@ -78,7 +77,7 @@ pub fn define_descriptor_advanced_settings<'a>(use_taproot: bool) -> Element<'a,
.push_maybe(if use_taproot {
Some(
p1_regular("Taproot is only supported by Liana version 5.0 and above")
.color(color::GREY_2),
.style(theme::text::secondary),
)
} else {
None
@ -150,13 +149,13 @@ pub fn uneditable_defined_key<'a>(
.push(
Row::new()
.spacing(10)
.push(p1_regular(title).color(color::GREY_2))
.push(p1_regular(title).style(theme::text::secondary))
.push(p1_bold(alias)),
)
.push_maybe(warning.map(|w| p2_regular(w).color(color::RED))),
.push_maybe(warning.map(|w| p2_regular(w).style(theme::text::error))),
)
.push_maybe(if warning.is_none() {
Some(icon::check_icon().color(color::GREEN))
Some(icon::check_icon().style(theme::text::success))
} else {
None
}),
@ -184,13 +183,13 @@ pub fn defined_key<'a>(
.push(
Row::new()
.spacing(10)
.push(p1_regular(format!("{}", title)).color(color::GREY_2))
.push(p1_regular(format!("{}", title)).style(theme::text::secondary))
.push(p1_bold(alias)),
)
.push_maybe(warning.map(|w| p2_regular(w).color(color::RED))),
.push_maybe(warning.map(|w| p2_regular(w).style(theme::text::error))),
)
.push_maybe(if warning.is_none() {
Some(icon::check_icon().color(color::GREEN))
Some(icon::check_icon().style(theme::text::success))
} else {
None
})
@ -358,7 +357,7 @@ pub fn edit_key_modal<'a>(
.push(text("Key name:").bold())
.push(tooltip(prompt::DEFINE_DESCRIPTOR_FINGERPRINT_TOOLTIP)),
)
.push(p1_regular("Give this key a friendly name. It helps you identify it later").color(color::GREY_2))
.push(p1_regular("Give this key a friendly name. It helps you identify it later").style(theme::text::secondary))
.push(
form::Form::new("Name", form_name, |msg| {
Message::DefineDescriptor(message::DefineDescriptor::KeyModal(
@ -375,7 +374,7 @@ pub fn edit_key_modal<'a>(
)
.push_maybe(
if duplicate_master_fg {
Some(text("A single signing device may not be used more than once per path. (It can still be used in other paths.)").color(color::RED))
Some(text("A single signing device may not be used more than once per path. (It can still be used in other paths.)").style(theme::text::error))
} else {
None
}

View File

@ -31,7 +31,7 @@ pub fn inheritance_template_description(progress: (usize, usize)) -> Element<'st
.max_width(800.0)
.push(Container::new(
p1_regular("For this setup you will need 2 Keys: Your Primary Key (for yourself) and an Inheritance Key (for your heir). For security reasons, we suggest you use a separate Hardware Wallet for each key.")
.color(color::GREY_2)
.style(theme::text::secondary)
.align_x(alignment::Horizontal::Left)
).align_x(alignment::Horizontal::Left).width(Length::Fill))
.push(Row::new()
@ -52,7 +52,7 @@ pub fn inheritance_template_description(progress: (usize, usize)) -> Element<'st
.push(Container::new(
p1_regular("You will always be able to spend using your Primary Key.
After a period of inactivity (but not before that) your Inheritance Key will become able to recover your funds.")
.color(color::GREY_2)
.style(theme::text::secondary)
.align_x(alignment::Horizontal::Left)
).align_x(alignment::Horizontal::Left).width(Length::Fill))
.push(image::inheritance_template_description().width(Length::Fill))

View File

@ -5,7 +5,6 @@ pub mod multisig_security_wallet;
use iced::{Alignment, Length};
use liana_ui::{
color,
component::text::{h3, p2_regular},
theme,
widget::*,
@ -27,7 +26,7 @@ pub fn choose_descriptor_template(progress: (usize, usize)) -> Element<'static,
Column::new()
.align_x(Alignment::Start)
.push(h3("Simple inheritance"))
.push(p2_regular("Two keys required, one for yourself to spend and another for your heir.").color(color::GREY_2))
.push(p2_regular("Two keys required, one for yourself to spend and another for your heir.").style(theme::text::secondary))
.width(Length::Fill)
)
.padding(15)
@ -43,7 +42,7 @@ pub fn choose_descriptor_template(progress: (usize, usize)) -> Element<'static,
Column::new()
.align_x(Alignment::Start)
.push(h3("Expanding multisig"))
.push(p2_regular("Two keys required to spend, with an extra key as a backup.").color(color::GREY_2))
.push(p2_regular("Two keys required to spend, with an extra key as a backup.").style(theme::text::secondary))
.width(Length::Fill)
)
.padding(15)
@ -59,7 +58,7 @@ pub fn choose_descriptor_template(progress: (usize, usize)) -> Element<'static,
Column::new()
.align_x(Alignment::Start)
.push(h3("Build your own"))
.push(p2_regular("Create a custom setup that fits all your needs.").color(color::GREY_2))
.push(p2_regular("Create a custom setup that fits all your needs.").style(theme::text::secondary))
.width(Length::Fill)
)
.padding(15)

View File

@ -36,7 +36,7 @@ pub fn multisig_security_template_description(
.max_width(800.0)
.push(Container::new(
p1_regular("For this setup you will need 3 keys: two Primary Keys and a Recovery Key. For security reasons, we suggest you use a separate Hardware Wallet for each key.")
.color(color::GREY_2)
.style(theme::text::secondary)
.align_x(alignment::Horizontal::Left)
).align_x(alignment::Horizontal::Left).width(Length::Fill))
.push(Row::new()
@ -45,24 +45,24 @@ pub fn multisig_security_template_description(
Row::new()
.align_y(Alignment::Center)
.spacing(10)
.push(icon::round_key_icon().size(H3_SIZE).color(color::GREEN))
.push(icon::round_key_icon().size(H3_SIZE).style(theme::text::success))
.push(p1_regular("Primary key #1").bold())
).push(
Row::new()
.align_y(Alignment::Center)
.spacing(10)
.push(icon::round_key_icon().size(H3_SIZE).color(color::GREEN))
.push(icon::round_key_icon().size(H3_SIZE).style(theme::text::success))
.push(p1_regular("Primary key #2").bold())
).push(
Row::new()
.align_y(Alignment::Center)
.spacing(10)
.push(icon::round_key_icon().size(H3_SIZE).color(color::ORANGE))
.push(icon::round_key_icon().size(H3_SIZE).style(theme::text::success))
.push(p1_regular("Recovery key").bold())
))
.push(Container::new(
p1_regular("The Primary Keys will compose a 2-of-2 multisig which will always be able to spend. In case one of your keys becomes unavailable, after a period of inactivity you will be able to recover your funds using the Recovery Key together with one of your Primary Keys (2-of-3 multisig):")
.color(color::GREY_2)
.style(theme::text::secondary)
.align_x(alignment::Horizontal::Left)
).align_x(alignment::Horizontal::Left).width(Length::Fill))
.push(image::multisig_security_template_description().width(Length::Fill))

View File

@ -20,7 +20,6 @@ use liana::{
miniscript::bitcoin::{self, bip32::Fingerprint},
};
use liana_ui::{
color,
component::{
button, card, collapse, form, hw, separation,
text::{h2, h3, h4_bold, h5_regular, p1_regular, text, Text},
@ -76,10 +75,10 @@ pub fn import_wallet_or_descriptor<'a>(
Button::new(
Column::new()
.spacing(5)
.push(h4_bold("Load a shared wallet").color(color::WHITE))
.push(h4_bold("Load a shared wallet").style(theme::text::primary))
.push(
text("If you received an invitation to join a shared wallet")
.color(color::GREY_3),
.style(theme::text::secondary),
),
)
.padding(15)
@ -90,10 +89,10 @@ pub fn import_wallet_or_descriptor<'a>(
Button::new(
Column::new()
.spacing(5)
.push(h4_bold("Load a shared wallet").color(color::WHITE))
.push(h4_bold("Load a shared wallet").style(theme::text::primary))
.push(
text("Type the invitation token you received by email")
.color(color::GREY_3),
.style(theme::text::secondary),
),
)
.padding(15)
@ -170,8 +169,11 @@ pub fn import_wallet_or_descriptor<'a>(
Button::new(
Column::new()
.spacing(5)
.push(h4_bold("Load a wallet from descriptor").color(color::WHITE))
.push(text("Creates a new wallet from the descriptor").color(color::GREY_3)),
.push(h4_bold("Load a wallet from descriptor").style(theme::text::primary))
.push(
text("Creates a new wallet from the descriptor")
.style(theme::text::secondary),
),
)
.padding(15)
.width(Length::Fill)
@ -181,8 +183,11 @@ pub fn import_wallet_or_descriptor<'a>(
Button::new(
Column::new()
.spacing(5)
.push(h4_bold("Load a wallet from descriptor").color(color::WHITE))
.push(text("Creates a new wallet from the descriptor").color(color::GREY_3)),
.push(h4_bold("Load a wallet from descriptor").style(theme::text::primary))
.push(
text("Creates a new wallet from the descriptor")
.style(theme::text::secondary),
),
)
.padding(15)
.width(Length::Fill)
@ -319,7 +324,7 @@ pub fn signer_xpubs<'a>(
Row::new().align_y(Alignment::Center).push(
Column::new()
.push(text("Generate a new mnemonic").bold())
.push(text(BACKUP_WARNING).small().color(color::ORANGE))
.push(text(BACKUP_WARNING).small().style(theme::text::warning))
.spacing(5)
.width(Length::Fill),
),
@ -510,7 +515,7 @@ pub fn share_xpubs<'a>(
.width(Length::Fill),
)
.push_maybe(if hws.is_empty() {
Some(p1_regular("No signing device connected").color(color::GREY_3))
Some(p1_regular("No signing device connected").style(theme::text::secondary))
} else {
None
})
@ -975,16 +980,16 @@ pub fn define_bitcoin_node<'a>(
Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Connection checked").color(color::GREEN)),
.push(icon::circle_check_icon().style(theme::text::success))
.push(text("Connection checked").style(theme::text::success)),
)
} else {
Container::new(
Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_cross_icon().color(color::RED))
.push(text("Connection failed").color(color::RED)),
.push(icon::circle_cross_icon().style(theme::text::error))
.push(text("Connection failed").style(theme::text::error)),
)
}
})
@ -1058,7 +1063,7 @@ pub fn define_bitcoind<'a>(
is not supported. Insert an IP address bound to the same machine \
running Liana (ignore this warning if that's already the case)",
)
.color(color::ORANGE)
.style(theme::text::warning)
.size(text::CAPTION_SIZE),
)
} else {
@ -1285,8 +1290,8 @@ pub fn start_internal_bitcoind<'a>(
DownloadState::Finished(_) => Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Download complete").color(color::GREEN)),
.push(icon::circle_check_icon().style(theme::text::success))
.push(text("Download complete").style(theme::text::success)),
DownloadState::Downloading { progress } => Row::new()
.spacing(10)
.align_y(Alignment::Center)
@ -1296,8 +1301,8 @@ pub fn start_internal_bitcoind<'a>(
DownloadState::Errored(e) => Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_cross_icon().color(color::RED))
.push(text(format!("Download failed: '{}'.", e)).color(color::RED)),
.push(icon::circle_cross_icon().style(theme::text::error))
.push(text(format!("Download failed: '{}'.", e)).style(theme::text::error)),
_ => Row::new().spacing(10).align_y(Alignment::Center),
}
}))
@ -1310,20 +1315,26 @@ pub fn start_internal_bitcoind<'a>(
InstallState::Finished => Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Installation complete").color(color::GREEN)),
.push(icon::circle_check_icon().style(theme::text::success))
.push(text("Installation complete").style(theme::text::success)),
InstallState::Errored(e) => Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_cross_icon().color(color::RED))
.push(text(format!("Installation failed: '{}'.", e)).color(color::RED)),
.push(icon::circle_cross_icon().style(theme::text::error))
.push(
text(format!("Installation failed: '{}'.", e))
.style(theme::text::error),
),
}
} else if exe_path.is_some() {
Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Liana-managed bitcoind already installed").color(color::GREEN))
.push(icon::circle_check_icon().style(theme::text::success))
.push(
text("Liana-managed bitcoind already installed")
.style(theme::text::success),
)
} else if let Some(DownloadState::Downloading { progress }) = download_state {
Row::new()
.spacing(10)
@ -1339,17 +1350,18 @@ pub fn start_internal_bitcoind<'a>(
Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Started").color(color::GREEN)),
.push(icon::circle_check_icon().style(theme::text::success))
.push(text("Started").style(theme::text::success)),
)
} else {
Container::new(
Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_cross_icon().color(color::RED))
.push(icon::circle_cross_icon().style(theme::text::error))
.push(
text(res.as_ref().err().unwrap().to_string()).color(color::RED),
text(res.as_ref().err().unwrap().to_string())
.style(theme::text::error),
),
)
}
@ -1411,8 +1423,8 @@ pub fn install<'a>(
Row::new()
.spacing(10)
.align_y(Alignment::Center)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Installed").color(color::GREEN)),
.push(icon::circle_check_icon().style(theme::text::success))
.push(text("Installed").style(theme::text::success)),
)
} else {
Container::new(Space::with_height(Length::Fixed(25.0)))
@ -1491,7 +1503,7 @@ pub fn defined_sequence<'a>(
.spacing(5)
.push(
text::p1_regular("Available after inactivity of ~")
.color(color::GREY_2),
.style(theme::text::secondary),
)
.push(
Button::new(
@ -1530,14 +1542,17 @@ pub fn defined_sequence<'a>(
)
} else {
Row::new()
.push(p1_regular("Able to move the funds at any time.").color(color::GREY_2))
.push(
p1_regular("Able to move the funds at any time.")
.style(theme::text::secondary),
)
.padding(5)
})
.push_maybe(if duplicate_sequence {
Some(
text("No two recovery options may become available at the very same date.")
.small()
.color(color::RED),
.style(theme::text::error),
)
} else {
None
@ -1768,7 +1783,10 @@ pub fn recover_mnemonic<'a>(
.width(Length::Fixed(100.0)),
)
.push_maybe(if *valid {
Some(icon::circle_check_icon().color(color::GREEN))
Some(
icon::circle_check_icon()
.style(theme::text::success),
)
} else {
None
}),
@ -1776,7 +1794,9 @@ pub fn recover_mnemonic<'a>(
},
))
.push(Space::with_height(Length::Fixed(50.0)))
.push_maybe(error.map(|e| card::invalid(text(e).color(color::RED)))),
.push_maybe(
error.map(|e| card::invalid(text(e).style(theme::text::error))),
),
)
} else {
None
@ -1832,14 +1852,16 @@ pub fn choose_backend(progress: (usize, usize)) -> Element<'static, Message> {
.spacing(20)
.width(Length::FillPortion(1))
.push(h3("Use your own node"))
.push(text::p2_medium(LOCAL_WALLET_DESC).color(color::GREY_3)),
.push(text::p2_medium(LOCAL_WALLET_DESC).style(theme::text::secondary)),
)
.push(
Column::new()
.spacing(20)
.width(Length::FillPortion(1))
.push(h3("Use Liana Connect"))
.push(text::p2_medium(REMOTE_BACKEND_DESC).color(color::GREY_3)),
.push(
text::p2_medium(REMOTE_BACKEND_DESC).style(theme::text::secondary),
),
),
)
.push(
@ -1900,8 +1922,8 @@ pub fn connection_step_enter_email<'a>(
) -> Element<'a, Message> {
Column::new()
.spacing(20)
.push_maybe(connection_error.map(|e| text(e.to_string()).color(color::ORANGE)))
.push_maybe(auth_error.map(|e| text(e.to_string()).color(color::ORANGE)))
.push_maybe(connection_error.map(|e| text(e.to_string()).style(theme::text::warning)))
.push_maybe(auth_error.map(|e| text(e.to_string()).style(theme::text::warning)))
.push(text(
"Enter the email you want to associate with the wallet:",
))
@ -1934,10 +1956,10 @@ pub fn connection_step_enter_otp<'a>(
) -> Element<'a, Message> {
Column::new()
.spacing(20)
.push(text(email).color(color::GREEN))
.push(text(email).style(theme::text::success))
.push(text("An authentication token has been emailed to you"))
.push_maybe(connection_error.map(|e| text(e.to_string()).color(color::ORANGE)))
.push_maybe(auth_error.map(|e| text(e.to_string()).color(color::ORANGE)))
.push_maybe(connection_error.map(|e| text(e.to_string()).style(theme::text::warning)))
.push_maybe(auth_error.map(|e| text(e.to_string()).style(theme::text::warning)))
.push(
form::Form::new_trimmed("Token", otp, |msg| {
Message::SelectBackend(message::SelectBackend::OTPEdited(msg))
@ -1972,9 +1994,9 @@ pub fn connection_step_connected<'a>(
) -> Element<'a, Message> {
Column::new()
.spacing(20)
.push(text(email).color(color::GREEN))
.push_maybe(connection_error.map(|e| text(e.to_string()).color(color::ORANGE)))
.push_maybe(auth_error.map(|e| text(e.to_string()).color(color::ORANGE)))
.push(text(email).style(theme::text::success))
.push_maybe(connection_error.map(|e| text(e.to_string()).style(theme::text::warning)))
.push_maybe(auth_error.map(|e| text(e.to_string()).style(theme::text::warning)))
.push(Container::new(
Row::new()
.spacing(10)
@ -2012,9 +2034,13 @@ fn layout<'a>(
Container::new(scrollable(
Column::new()
.width(Length::Fill)
.push(Row::new().push(Space::with_width(Length::Fill)).push_maybe(
email.map(|e| Container::new(p1_regular(e).color(color::GREEN)).padding(20)),
))
.push(
Row::new()
.push(Space::with_width(Length::Fill))
.push_maybe(email.map(|e| {
Container::new(p1_regular(e).style(theme::text::success)).padding(20)
})),
)
.push(Space::with_height(Length::Fixed(100.0)))
.push(
Row::new()

View File

@ -8,7 +8,6 @@ use iced::{
use liana::miniscript::bitcoin::Network;
use liana_ui::{
color,
component::{button, card, modal::Modal, network_banner, notification, text::*},
icon, image, theme,
widget::*,
@ -225,7 +224,7 @@ impl Launcher {
"Liana-{}",
checksum
))
.color(color::GREY_3)
.style(theme::text::secondary)
},
))
.push_maybe(email.as_ref().map(|email| {
@ -234,8 +233,9 @@ impl Launcher {
Length::Fill,
))
.push(
p1_regular(email)
.color(color::GREEN),
p1_regular(email).style(
theme::text::secondary,
),
)
})),
)
@ -271,7 +271,7 @@ impl Launcher {
)
.push(
p1_regular("Create a new Liana wallet")
.color(color::GREY_3),
.style(theme::text::secondary),
)
.push(
button::secondary(None, "Select")
@ -297,7 +297,7 @@ impl Launcher {
p1_regular(
"Add an existing Liana wallet",
)
.color(color::GREY_3),
.style(theme::text::secondary),
)
.push(
button::secondary(None, "Select")
@ -425,12 +425,13 @@ impl DeleteWalletModal {
.spacing(10)
.push(Container::new(
h4_bold(format!("Delete configuration for {}", &self.network))
.color(color::RED)
.style(theme::text::destructive)
.width(Length::Fill),
))
.push(Row::new().push(text(help_text_1)))
.push_maybe(
help_text_2.map(|t| Row::new().push(p1_regular(t).color(color::GREY_3))),
help_text_2
.map(|t| Row::new().push(p1_regular(t).style(theme::text::secondary))),
)
.push(Row::new())
.push(Row::new().push(text(help_text_3)))
@ -443,8 +444,10 @@ impl DeleteWalletModal {
} else {
Row::new()
.spacing(10)
.push(icon::circle_check_icon().color(color::GREEN))
.push(text("Wallet successfully deleted").color(color::GREEN))
.push(icon::circle_check_icon().style(theme::text::success))
.push(
text("Wallet successfully deleted").style(theme::text::success),
)
})
.align_x(Horizontal::Center)
.width(Length::Fill),

View File

@ -4,9 +4,8 @@ use iced::{Alignment, Length, Task};
use liana::miniscript::bitcoin::Network;
use liana_ui::{
color,
component::{button, form, network_banner, notification, text::*},
icon,
icon, theme,
widget::*,
};
@ -391,7 +390,7 @@ impl LianaLiteLogin {
.spacing(20)
.push_maybe(
self.auth_error
.map(|e| text(e).color(color::ORANGE)),
.map(|e| text(e).style(theme::text::warning)),
)
.push(
form::Form::new_trimmed("email", email, |msg| {
@ -412,7 +411,7 @@ impl LianaLiteLogin {
.push(text("An authentication was send to your email"))
.push_maybe(
self.auth_error
.map(|e| text(e).color(color::ORANGE)),
.map(|e| text(e).style(theme::text::warning)),
)
.spacing(20)
.push(

View File

@ -13,9 +13,8 @@ use tracing::{debug, info, warn};
use liana::miniscript::bitcoin;
use liana_ui::{
color,
component::{button, notification, text::*},
icon,
icon, theme,
widget::*,
};
use lianad::{
@ -465,7 +464,7 @@ pub fn view(step: &Step) -> Element<ViewMessage> {
} else {
SYNCING_PROGRESS_1
}))
.push(p2_regular(bitcoind_logs).color(color::GREY_3)),
.push(p2_regular(bitcoind_logs).style(theme::text::secondary)),
),
Step::Error(error) => cover(
Some(("Error while starting the internal daemon", error)),

View File

@ -30,6 +30,30 @@ pub fn secondary(theme: &Theme) -> Style {
}
}
pub fn success(theme: &Theme) -> Style {
Style {
color: Some(theme.colors.text.success),
}
}
pub fn warning(theme: &Theme) -> Style {
Style {
color: Some(theme.colors.text.warning),
}
}
pub fn destructive(theme: &Theme) -> Style {
Style {
color: Some(theme.colors.text.warning),
}
}
pub fn error(theme: &Theme) -> Style {
Style {
color: Some(theme.colors.text.error),
}
}
pub fn custom(color: iced::Color) -> Style {
Style { color: Some(color) }
}