Components / ColorWheel

ColorWheel

Hue and saturation on a disc, by a drag or the arrow keys.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn color_wheel() -> impl View {
    let tint = State::new(HueSaturation::new(30.0, 0.4));
    let shown = tint.clone();
    HStack::new((
        ColorWheel::new(tint.binding()).diameter(160.0).label("Shadows"),
        Text::bound(&shown, |v| format!("{:.0}°, {:.0}%", v.hue, v.saturation * 100.0))
            .style(TextStyle::Callout)
            .foreground(Semantic::InkMuted),
    ))
    .spacing(16.0)
}

Open in the playground, with every example →

Full API of ColorWheel →