Commit graph

23 commits

Author SHA1 Message Date
Héctor Ramón Jiménez
d7a5e54455 Require Clone for Message early when needed
Prior to this change, the widgets that needed a `Clone` bound on `Message` to
implement the `Widget` trait could be created with a non-cloneable `Message`.

As a consequence, the compiler complained only when actually trying to use the
`Widget` trait. Normally, this happens when trying to `push` the widget in a
container or turn it into an `Element`.

Furthermore, the compiler error in this case does not mention `Message` nor the
`Clone` bound, but instead complains about a missing `From` implementation.
Thus, it can easily cause confusion!

This change introduces `Clone` bounds in the main implementation of the
widgets that need it to properly implement the `Widget` trait. As a
result, the compiler complains early when trying to create one of these widgets
with a non-cloneable `Message` and explicitly mentions that the `Message` needs
to implement `Clone`.
2020-10-17 08:10:30 +02:00
Héctor Ramón Jiménez
c1f79b40cf Make Application and Sandbox return a Result 2020-09-08 00:44:59 +02:00
Héctor Ramón Jiménez
d7d2e0a8aa Increase precision in color_palette example 2020-06-13 14:50:21 +02:00
Sebastian Zivota
c3643eaf6d Add step member to slider widgets
Both the native and the web slider now have a member `step` to control
the least possible change of the slider's value. It defaults to 1.0
for all sliders and can be adjusted with the step method.
2020-06-11 00:18:24 +02:00
Héctor Ramón Jiménez
80e2d1b08b Adapt color_palette to new canvas API 2020-05-04 23:46:15 +02:00
Héctor Ramón Jiménez
e3555174d7 Use only iced dependency for color_palette
`Point` and `Size` are now properly re-exported.
2020-05-04 22:55:10 +02:00
Héctor Ramón Jiménez
3d3e51a742 Add screenshot to README of color_palette 2020-05-04 22:53:07 +02:00
Héctor Ramón Jiménez
1a8d253611 Add screenshot of color_palette example 2020-05-04 22:51:20 +02:00
Héctor Ramón Jiménez
03ca7eea6c Reuse triangle path with transforms in color_palette 2020-05-01 22:45:47 +02:00
Héctor Ramón Jiménez
573929d5ec Use Path::rectangle directly in color_palette 2020-05-01 22:32:40 +02:00
Héctor Ramón Jiménez
555371f77e Move application implementation in color_palette 2020-05-01 22:27:14 +02:00
Héctor Ramón Jiménez
4d724a88e6 Introduce Theme type in color_palette example 2020-05-01 22:24:34 +02:00
Héctor Ramón Jiménez
0a011f9031 Improve generate_theme in color_palette 2020-05-01 21:51:08 +02:00
Héctor Ramón Jiménez
11e4039b56 Remove update_component in color_palette
We can use `ColorSpace::new` instead
2020-05-01 21:43:11 +02:00
Clark Moody
430f78a693 Abstract into ColorPicker and ColorSpace trait
Each color type implements ColorSpace to define its own representation
and update methods.

View sliders are implemented on the ColorPicker struct.
2020-04-27 16:25:13 -05:00
Clark Moody
3e71eaee37 Use Path::rectangle and Size for drawing swatches 2020-04-24 15:40:28 -05:00
Clark Moody
758a444d7f Replace text input fields for simple text 2020-04-24 15:31:12 -05:00
Clark Moody
27fadad324 Do not re-export Palette from iced_core 2020-04-24 15:20:00 -05:00
Clark Moody
4b90241ea1 Hex label text alignment 2020-04-24 15:13:22 -05:00
Clark Moody
39fd8ad9e9 TextInput fields with color encodings. Draw shades. 2020-04-24 15:13:22 -05:00
Clark Moody
b1328f193c More theme colors and gradient of lightness 2020-04-24 15:13:22 -05:00
Clark Moody
6b18e78e53 Use canvas to draw color palette for example 2020-04-24 15:13:22 -05:00
Clark Moody
664a63a4b8 Add example program: color palette
Sliders for many color spaces update as any other sliders are moved
around. Color is space is clamped to sRGB, so Lab and Lch color spaces
cannot be fully expressed.

TODO:
- Real-time manipulation of base color to create a color scheme.
- Show slider value under each slider
- Show output values in text boxes for each color space
2020-04-24 15:13:22 -05:00