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§

source

fn start_color(&self) -> Color

Returns the color to display at the start of the component picker.

source

fn end_color(&self) -> Color

Returns the color to display at the end of the component picker.

source

fn interpolate_color(&self, percent: ZeroToOne) -> Color

Interpolate the color at the given percentage between the start and end colors.

Provided Methods§

source

fn loupe_color(&self, percent: ZeroToOne) -> Option<Color>

Returns the color to to display within the loupe.

source

fn draw_background( &self, rect: Rect<Px>, graphics: &mut GraphicsContext<'_, '_, '_, '_>, )

Draws the background behind the color component.

Implementors§