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) <noreply@anthropic.com>
This commit is contained in:
Mae PUGIN 2026-04-07 13:35:08 +02:00
parent af32862c76
commit 2f53119178
2 changed files with 9 additions and 7 deletions

View file

@ -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::<AdvancedBridge>().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<MacroData> = macro_data.iter().map(|m| {
let steps_str: Vec<String> = m.steps.iter().map(|s| {

View file

@ -6,15 +6,18 @@ export component KeyButton inherits Rectangle {
in property <float> scale: 1.0;
callback clicked(int);
// Heat color: dark purple (cold) -> orange -> bright red (hot)
// Heat color: stepped gradient for clarity
property <color> 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 <bool> is-heatmap: KeymapBridge.heatmap-enabled && data.heat > 0;
property <color> base-color: root.is-heatmap ? root.heat-color : data.color;
property <color> text-color: root.is-heatmap && data.heat > 0.3 ? #1a1a2e : Theme.fg-primary;
property <color> text-color: root.is-heatmap && data.heat > 0.2 ? #1a1a2e : Theme.fg-primary;
width: data.w;
height: data.h;