pub struct ColorPicker { /* private fields */ }Expand description
HSV-based gradient color picker.
§Example
fn app() -> impl IntoElement {
let mut color = use_state(|| Color::from_hsv(0.0, 1.0, 1.0));
rect()
.padding(6.)
.child(ColorPicker::new(move |c| color.set(c)).value(color()))
}§Preview
The preview image is generated by simulating a click on the preview so the popup is shown.
This is done using the with_hook helper in the doc test to move the cursor and click the preview.
Implementations§
Source§impl ColorPicker
impl ColorPicker
pub fn new(on_change: impl Into<EventHandler<Color>>) -> ColorPicker
pub fn value(self, value: Color) -> ColorPicker
pub fn width(self, width: impl Into<Size>) -> ColorPicker
Trait Implementations§
Source§impl Clone for ColorPicker
impl Clone for ColorPicker
Source§fn clone(&self) -> ColorPicker
fn clone(&self) -> ColorPicker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ColorPickerThemePartialExt for ColorPicker
impl ColorPickerThemePartialExt for ColorPicker
fn background(self, background: impl Into<Color>) -> ColorPicker
fn color(self, color: impl Into<Color>) -> ColorPicker
fn border_fill(self, border_fill: impl Into<Color>) -> ColorPicker
Source§impl Component for ColorPicker
impl Component for ColorPicker
fn render(&self) -> impl IntoElement
fn render_key(&self) -> DiffKey
Source§impl KeyExt for ColorPicker
impl KeyExt for ColorPicker
Source§impl PartialEq for ColorPicker
impl PartialEq for ColorPicker
impl StructuralPartialEq for ColorPicker
Auto Trait Implementations§
impl Freeze for ColorPicker
impl !RefUnwindSafe for ColorPicker
impl !Send for ColorPicker
impl !Sync for ColorPicker
impl Unpin for ColorPicker
impl !UnwindSafe for ColorPicker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ComponentKey for Twhere
T: Component,
impl<T> ComponentKey for Twhere
T: Component,
fn default_key(&self) -> DiffKey
Source§impl<T> ComponentProps for T
impl<T> ComponentProps for T
fn changed(&self, other: &(dyn ComponentProps + 'static)) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more