Use Theme background in styling example
This commit is contained in:
parent
3e2b6247f7
commit
a206d22670
1 changed files with 2 additions and 27 deletions
|
|
@ -147,7 +147,6 @@ impl Sandbox for Styling {
|
|||
.height(Length::Fill)
|
||||
.center_x()
|
||||
.center_y()
|
||||
.style(self.theme)
|
||||
.into()
|
||||
}
|
||||
|
||||
|
|
@ -160,9 +159,7 @@ impl Sandbox for Styling {
|
|||
}
|
||||
|
||||
mod style {
|
||||
use iced::{
|
||||
checkbox, container, progress_bar, rule, scrollable, text_input,
|
||||
};
|
||||
use iced::{checkbox, progress_bar, rule, scrollable, text_input};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Theme {
|
||||
|
|
@ -180,15 +177,6 @@ mod style {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<Theme> for Box<dyn container::StyleSheet + 'a> {
|
||||
fn from(theme: Theme) -> Self {
|
||||
match theme {
|
||||
Theme::Light => Default::default(),
|
||||
Theme::Dark => dark::Container.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<Theme> for Box<dyn text_input::StyleSheet + 'a> {
|
||||
fn from(theme: Theme) -> Self {
|
||||
match theme {
|
||||
|
|
@ -236,8 +224,7 @@ mod style {
|
|||
|
||||
mod dark {
|
||||
use iced::{
|
||||
checkbox, container, progress_bar, rule, scrollable, text_input,
|
||||
Color,
|
||||
checkbox, progress_bar, rule, scrollable, text_input, Color,
|
||||
};
|
||||
|
||||
const SURFACE: Color = Color::from_rgb(
|
||||
|
|
@ -264,18 +251,6 @@ mod style {
|
|||
0xC4 as f32 / 255.0,
|
||||
);
|
||||
|
||||
pub struct Container;
|
||||
|
||||
impl container::StyleSheet for Container {
|
||||
fn style(&self) -> container::Style {
|
||||
container::Style {
|
||||
background: Color::from_rgb8(0x36, 0x39, 0x3F).into(),
|
||||
text_color: Color::WHITE.into(),
|
||||
..container::Style::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TextInput;
|
||||
|
||||
impl text_input::StyleSheet for TextInput {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue