Remove hardcoded colors from todos example

This commit is contained in:
Héctor Ramón Jiménez 2025-09-08 11:22:13 +02:00
parent 7fedb0cc9b
commit b5974a23cc
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 10 additions and 4 deletions

View file

@ -1 +1 @@
99f418007af163f172e163565f166da31015521e1bf7de95fa55cda2fb5a7db5
0acb67235c6a11014a2d2b825e0a70069bca0c67bee0cdb38a0144fc72b25220

View file

@ -5,7 +5,7 @@ use iced::widget::{
};
use iced::window;
use iced::{
Center, Element, Fill, Font, Function, Subscription, Task as Command,
Center, Element, Fill, Font, Function, Subscription, Task as Command, Theme,
};
use serde::{Deserialize, Serialize};
@ -194,7 +194,7 @@ impl Todos {
let title = text("todos")
.width(Fill)
.size(100)
.color([0.5, 0.5, 0.5])
.style(subtle)
.align_x(Center);
let input = text_input("What needs to be done?", input_value)
@ -447,7 +447,7 @@ fn empty_message(message: &str) -> Element<'_, Message> {
.width(Fill)
.size(25)
.align_x(Center)
.color([0.7, 0.7, 0.7]),
.style(subtle),
)
.height(200)
.into()
@ -471,6 +471,12 @@ fn delete_icon() -> Text<'static> {
icon('\u{F1F8}')
}
fn subtle(theme: &Theme) -> text::Style {
text::Style {
color: Some(theme.extended_palette().background.strongest.color),
}
}
// Persistence
#[derive(Debug, Clone, Serialize, Deserialize)]
struct SavedState {