Simplify theming for Application

This commit is contained in:
Héctor Ramón Jiménez 2024-03-06 21:27:03 +01:00
parent 34e7c6593a
commit 7c4bf70023
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
14 changed files with 382 additions and 392 deletions

View file

@ -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)
}
}
}