diff options
author | 2019-12-05 01:57:35 +0100 | |
---|---|---|
committer | 2019-12-05 01:57:35 +0100 | |
commit | e92ea48e8814b42fc566017db085ca9bdaf3c272 (patch) | |
tree | 48413064237f8b00b4b4c8668a96fc5ca79d995a /examples | |
parent | f87ddf1056327551b4a2bba9e98cbb7816b6666c (diff) | |
download | iced-e92ea48e8814b42fc566017db085ca9bdaf3c272.tar.gz iced-e92ea48e8814b42fc566017db085ca9bdaf3c272.tar.bz2 iced-e92ea48e8814b42fc566017db085ca9bdaf3c272.zip |
Make `Button::background` generic
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pokedex.rs | 6 | ||||
-rw-r--r-- | examples/todos.rs | 10 | ||||
-rw-r--r-- | examples/tour.rs | 13 |
3 files changed, 13 insertions, 16 deletions
diff --git a/examples/pokedex.rs b/examples/pokedex.rs index 6893bb73..b9daeabd 100644 --- a/examples/pokedex.rs +++ b/examples/pokedex.rs @@ -1,6 +1,6 @@ use iced::{ - button, image, Align, Application, Button, Color, Column, - Command, Container, Element, Image, Length, Row, Settings, Text, + button, image, Align, Application, Button, Color, Column, Command, + Container, Element, Image, Length, Row, Settings, Text, }; pub fn main() { @@ -225,7 +225,7 @@ impl From<reqwest::Error> for Error { fn button<'a>(state: &'a mut button::State, text: &str) -> Button<'a, Message> { Button::new(state, Text::new(text).color(Color::WHITE)) - .background(Color::from_rgb(0.11, 0.42, 0.87).into()) + .background(Color::from_rgb(0.11, 0.42, 0.87)) .border_radius(10) .padding(10) } diff --git a/examples/todos.rs b/examples/todos.rs index 684c9fea..5f435fdc 100644 --- a/examples/todos.rs +++ b/examples/todos.rs @@ -1,7 +1,7 @@ use iced::{ - button, scrollable, text_input, Align, Application, Button, - Checkbox, Color, Column, Command, Container, Element, Font, - HorizontalAlignment, Length, Row, Scrollable, Settings, Text, TextInput, + button, scrollable, text_input, Align, Application, Button, Checkbox, + Color, Column, Command, Container, Element, Font, HorizontalAlignment, + Length, Row, Scrollable, Settings, Text, TextInput, }; use serde::{Deserialize, Serialize}; @@ -332,7 +332,7 @@ impl Task { .on_press(TaskMessage::Delete) .padding(10) .border_radius(5) - .background(Color::from_rgb(0.8, 0.2, 0.2).into()), + .background(Color::from_rgb(0.8, 0.2, 0.2)), ) .into() } @@ -361,7 +361,7 @@ impl Controls { let label = Text::new(label).size(16).width(Length::Shrink); let button = if filter == current_filter { Button::new(state, label.color(Color::WHITE)) - .background(Color::from_rgb(0.2, 0.2, 0.7).into()) + .background(Color::from_rgb(0.2, 0.2, 0.7)) } else { Button::new(state, label) }; diff --git a/examples/tour.rs b/examples/tour.rs index 53a8e662..b06fbc37 100644 --- a/examples/tour.rs +++ b/examples/tour.rs @@ -1,7 +1,7 @@ use iced::{ - button, scrollable, slider, text_input, Button, Checkbox, - Color, Column, Container, Element, HorizontalAlignment, Image, Length, - Radio, Row, Sandbox, Scrollable, Settings, Slider, Text, TextInput, + button, scrollable, slider, text_input, Button, Checkbox, Color, Column, + Container, Element, HorizontalAlignment, Image, Length, Radio, Row, + Sandbox, Scrollable, Settings, Slider, Text, TextInput, }; pub fn main() { @@ -684,17 +684,14 @@ fn primary_button<'a, Message>( state: &'a mut button::State, label: &str, ) -> Button<'a, Message> { - button(state, label) - .background(Color::from_rgb(0.11, 0.42, 0.87).into()) + button(state, label).background(Color::from_rgb(0.11, 0.42, 0.87)) } fn secondary_button<'a, Message>( state: &'a mut button::State, label: &str, ) -> Button<'a, Message> { - button(state, label) - .background(Color::from_rgb(0.4, 0.4, 0.4).into()) - + button(state, label).background(Color::from_rgb(0.4, 0.4, 0.4)) } #[derive(Debug, Clone, Copy, PartialEq, Eq)] |