Function egui::widgets::color_picker::color_slider_2d

source ·
fn color_slider_2d(
    ui: &mut Ui,
    x_value: &mut f32,
    y_value: &mut f32,
    color_at: impl Fn(f32, f32) -> Color32,
) -> Response
Expand description

§Arguments

  • x_value - X axis, either saturation or value (0.0-1.0).
  • y_value - Y axis, either saturation or value (0.0-1.0).
  • color_at - A function that dictates how the mix of saturation and value will be displayed in the 2d slider.

e.g.: |x_value, y_value| HsvaGamma { h: 1.0, s: x_value, v: y_value, a: 1.0 }.into() displays the colors as follows:

  • top-left: white [s: 0.0, v: 1.0]
  • top-right: fully saturated color [s: 1.0, v: 1.0]
  • bottom-right: black [s: 0.0, v: 1.0].