Comment by elcritch
16 hours ago
The dynamic lighting setup is pretty cool. Not sure how practical it is for most applications but cool.
But this syntax – egads man! It literally hurts my brain trying to parse it:
fn view(s: &State, _: &mut Cx<State>) -> El {
let t = tok::theme(true);
let label = text(if s.on { "Lights on" } else { "Lights off" })
.font(type_::TITLE).color(t.text);
let knob = el().key("knob").size(18.0, 18.0).radius(9.0).fill(t.knob)
.absolute(if s.on { 18.0 } else { 2.0 }, 2.0);
let switch = el().key("switch").role("switch").label("Lights").checked(s.on)
.focusable(true).size(38.0, 22.0).radius(11.0)
.fill(if s.on { tok::accent(0, true) } else { t.control_off })
.motion(motion::SNAPPY)
.on_press(|s: &mut State| s.on = !s.on)
.child(knob);
col().w_full().h_full().center().gap(16.0).fill(t.bg).child(label).child(switch)
}
Maybe I'm getting too old but I'd prefer good old Perl 5 linenoise.
No comments yet
Contribute on Hacker News ↗