summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer/widget/checkbox.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-07 17:44:27 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-07 17:44:27 +0100
commit59ef7f074c67126dd8bd0ae9cbc82ce2a946258f (patch)
tree5004ae812a39d36b3880d340101806edcf6abd04 /wgpu/src/renderer/widget/checkbox.rs
parent6790f4b6e36f21b5db9ef02f5e499df8336abfea (diff)
parente7bd24c13eb0c5c2b8ecf3f09f9e2de315bf8a41 (diff)
downloadiced-59ef7f074c67126dd8bd0ae9cbc82ce2a946258f.tar.gz
iced-59ef7f074c67126dd8bd0ae9cbc82ce2a946258f.tar.bz2
iced-59ef7f074c67126dd8bd0ae9cbc82ce2a946258f.zip
Merge pull request #46 from memoryruins/from-array
impl From<Array> for Color
Diffstat (limited to 'wgpu/src/renderer/widget/checkbox.rs')
-rw-r--r--wgpu/src/renderer/widget/checkbox.rs30
1 files changed, 9 insertions, 21 deletions
diff --git a/wgpu/src/renderer/widget/checkbox.rs b/wgpu/src/renderer/widget/checkbox.rs
index 5867a36f..1594c769 100644
--- a/wgpu/src/renderer/widget/checkbox.rs
+++ b/wgpu/src/renderer/widget/checkbox.rs
@@ -1,7 +1,7 @@
use crate::{Primitive, Renderer};
use iced_native::{
checkbox, text, text::HorizontalAlignment, text::VerticalAlignment, Align,
- Background, Checkbox, Color, Column, Layout, Length, MouseCursor, Node,
+ Background, Checkbox, Column, Layout, Length, MouseCursor, Node,
Point, Rectangle, Row, Text, Widget,
};
@@ -46,12 +46,7 @@ impl checkbox::Renderer for Renderer {
let (checkbox_border, checkbox_box) = (
Primitive::Quad {
bounds: checkbox_bounds,
- background: Background::Color(Color {
- r: 0.6,
- g: 0.6,
- b: 0.6,
- a: 1.0,
- }),
+ background: Background::Color([0.6, 0.6, 0.6].into()),
border_radius: 6,
},
Primitive::Quad {
@@ -61,21 +56,14 @@ impl checkbox::Renderer for Renderer {
width: checkbox_bounds.width - 2.0,
height: checkbox_bounds.height - 2.0,
},
- background: Background::Color(if is_mouse_over {
- Color {
- r: 0.90,
- g: 0.90,
- b: 0.90,
- a: 1.0,
+ background: Background::Color(
+ if is_mouse_over {
+ [0.90, 0.90, 0.90]
+ } else {
+ [0.95, 0.95, 0.95]
}
- } else {
- Color {
- r: 0.95,
- g: 0.95,
- b: 0.95,
- a: 1.0,
- }
- }),
+ .into(),
+ ),
border_radius: 5,
},
);