From 2f53119178d9a2ce1c978d99c8c3eead47592499 Mon Sep 17 00:00:00 2001 From: Mae PUGIN <48982737+mornepousse@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:35:08 +0200 Subject: [PATCH] fix: Heatmap gradient with stepped colors for clarity mix() was not rendering correctly. Replaced with stepped thresholds: - >80%: bright red (#ff0000) - >60%: red-orange (#ff4400) - >40%: orange (#ff8800) - >20%: yellow (#ffcc00) - >5%: cool blue (#446688) - <=5%: very cold (#2d2d44) Dark text when heat > 20%. Removed debug eprintln. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/main.rs | 3 +-- ui/components/key_button.slint | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8fb798a..199e432 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1290,7 +1290,7 @@ fn main() { let steps_text = steps_str.join(","); drop(steps); let cmd = logic::protocol::cmd_macroseq(slot_num, &name, &steps_text); - eprintln!("MACRO SAVE: {}", cmd); + let serial = serial.clone(); let tx = tx.clone(); std::thread::spawn(move || { @@ -1687,7 +1687,6 @@ fn main() { window.global::().set_bt_status(SharedString::from(bt_text)); } "macros" => { - eprintln!("MACRO raw lines: {:?}", lines); let macro_data = logic::parsers::parse_macro_lines(&lines); let model: Vec = macro_data.iter().map(|m| { let steps_str: Vec = m.steps.iter().map(|s| { diff --git a/ui/components/key_button.slint b/ui/components/key_button.slint index 800ec1b..e6b8a9f 100644 --- a/ui/components/key_button.slint +++ b/ui/components/key_button.slint @@ -6,15 +6,18 @@ export component KeyButton inherits Rectangle { in property scale: 1.0; callback clicked(int); - // Heat color: dark purple (cold) -> orange -> bright red (hot) + // Heat color: stepped gradient for clarity property heat-color: - data.heat < 0.5 - ? #2d1b69.mix(#e67e22, data.heat * 2) - : #e67e22.mix(#e74c3c, (data.heat - 0.5) * 2); + data.heat > 0.8 ? #ff0000 // bright red + : data.heat > 0.6 ? #ff4400 // red-orange + : data.heat > 0.4 ? #ff8800 // orange + : data.heat > 0.2 ? #ffcc00 // yellow + : data.heat > 0.05 ? #446688 // cool blue + : #2d2d44; // very cold property is-heatmap: KeymapBridge.heatmap-enabled && data.heat > 0; property base-color: root.is-heatmap ? root.heat-color : data.color; - property text-color: root.is-heatmap && data.heat > 0.3 ? #1a1a2e : Theme.fg-primary; + property text-color: root.is-heatmap && data.heat > 0.2 ? #1a1a2e : Theme.fg-primary; width: data.w; height: data.h;