From 7c4bf70023a8092faad9630c2c87fbf41bd6ab76 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 6 Mar 2024 21:27:03 +0100 Subject: Simplify theming for `Application` --- examples/gradient/src/main.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'examples/gradient/src') diff --git a/examples/gradient/src/main.rs b/examples/gradient/src/main.rs index 3334bde9..6d3ff125 100644 --- a/examples/gradient/src/main.rs +++ b/examples/gradient/src/main.rs @@ -1,11 +1,11 @@ use iced::application; -use iced::theme::{self, Theme}; use iced::widget::{ checkbox, column, container, horizontal_space, row, slider, text, themer, }; use iced::{gradient, window}; use iced::{ Alignment, Background, Color, Element, Length, Radians, Sandbox, Settings, + Theme, }; pub fn main() -> iced::Result { @@ -115,16 +115,14 @@ impl Sandbox for Gradient { .into() } - fn style(&self) -> theme::Application { + fn style(&self, theme: &Theme) -> application::Appearance { if self.transparent { - theme::Application::custom(|theme: &Theme| { - application::Appearance { - background_color: Color::TRANSPARENT, - text_color: theme.palette().text, - } - }) + application::Appearance { + background_color: Color::TRANSPARENT, + text_color: theme.palette().text, + } } else { - theme::Application::Default + application::default(theme) } } } -- cgit