From b5974a23ccff58f13c3bf9db54fd8b60cb9c9f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 8 Sep 2025 11:22:13 +0200 Subject: [PATCH] Remove hardcoded colors from `todos` example --- .../snapshots/creates_a_new_task-tiny-skia.sha256 | 2 +- examples/todos/src/main.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/todos/snapshots/creates_a_new_task-tiny-skia.sha256 b/examples/todos/snapshots/creates_a_new_task-tiny-skia.sha256 index e6746cf8..f56ef744 100644 --- a/examples/todos/snapshots/creates_a_new_task-tiny-skia.sha256 +++ b/examples/todos/snapshots/creates_a_new_task-tiny-skia.sha256 @@ -1 +1 @@ -99f418007af163f172e163565f166da31015521e1bf7de95fa55cda2fb5a7db5 \ No newline at end of file +0acb67235c6a11014a2d2b825e0a70069bca0c67bee0cdb38a0144fc72b25220 \ No newline at end of file diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index ed767e70..9c57487c 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -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 {