Trait cushy::widgets::color::ColorComponent
source · pub trait ColorComponent:
Debug
+ Send
+ 'static {
// Required methods
fn start_color(&self) -> Color;
fn end_color(&self) -> Color;
fn interpolate_color(&self, percent: ZeroToOne) -> Color;
// Provided methods
fn loupe_color(&self, percent: ZeroToOne) -> Option<Color> { ... }
fn draw_background(
&self,
rect: Rect<Px>,
graphics: &mut GraphicsContext<'_, '_, '_, '_>,
) { ... }
}
Expand description
A component that can be picked in a ComponentPicker
.
Required Methods§
sourcefn start_color(&self) -> Color
fn start_color(&self) -> Color
Returns the color to display at the start of the component picker.
sourcefn interpolate_color(&self, percent: ZeroToOne) -> Color
fn interpolate_color(&self, percent: ZeroToOne) -> Color
Interpolate the color at the given percentage between the start and end colors.
Provided Methods§
sourcefn loupe_color(&self, percent: ZeroToOne) -> Option<Color>
fn loupe_color(&self, percent: ZeroToOne) -> Option<Color>
Returns the color to to display within the loupe.
sourcefn draw_background(
&self,
rect: Rect<Px>,
graphics: &mut GraphicsContext<'_, '_, '_, '_>,
)
fn draw_background( &self, rect: Rect<Px>, graphics: &mut GraphicsContext<'_, '_, '_, '_>, )
Draws the background behind the color component.