cushy/examples/color-pickers.rs
Jonathan Johnson 246352fed2
Added HslPicker
2024-01-10 08:17:09 -08:00

27 lines
697 B
Rust

use cushy::styles::Hsl;
use cushy::value::{Dynamic, Source};
use cushy::widget::MakeWidget;
use cushy::widgets::color::HslPicker;
use cushy::widgets::Space;
use cushy::Run;
use figures::units::Lp;
use figures::Size;
use kludgine::Color;
fn main() -> cushy::Result {
let hsl = Dynamic::new(Hsl::from(Color::RED));
let color = hsl.map_each_cloned(Color::from);
"Picker"
.and(HslPicker::new(hsl).expand())
.into_rows()
.expand()
.and(
"Picked Color"
.and(Space::colored(color).size(Size::squared(Lp::inches(1))))
.into_rows(),
)
.into_columns()
.pad()
.expand()
.run()
}