Components / ColorPicker

ColorPicker

A color from a palette, a shade square or typed.

Example

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

Code

use ravenrs::prelude::*;

fn color_picker() -> impl View {
    let color = State::new(Some(Color::hex(0x2563EB)));
    ColorPicker::new(color.binding())
        .alpha(true)
        .palette([
            (Color::hex(0x2563EB), "Blue"),
            (Color::hex(0x16A34A), "Green"),
            (Color::hex(0xDC2626), "Red"),
            (Color::hex(0xF59E0B), "Amber"),
        ])
        .label("Category color")
}

Open in the playground, with every example →

Full API of ColorPicker →