From 6f0101a861a6d94aca11ccdd382b432c1122883e Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Sun, 29 Mar 2026 10:57:34 +0100 Subject: [PATCH] DX stats table #99 --- templates/about.html | 2 +- templates/add_spot.html | 4 ++-- templates/alerts.html | 4 ++-- templates/bands.html | 6 +++--- templates/base.html | 8 ++++---- templates/conditions.html | 4 ++-- templates/map.html | 6 +++--- templates/spots.html | 6 +++--- templates/status.html | 4 ++-- webassets/js/conditions.js | 15 ++------------- 10 files changed, 24 insertions(+), 35 deletions(-) diff --git a/templates/about.html b/templates/about.html index 15ab16a..bdab514 100644 --- a/templates/about.html +++ b/templates/about.html @@ -67,7 +67,7 @@

This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.

- + {% end %} \ No newline at end of file diff --git a/templates/add_spot.html b/templates/add_spot.html index 4e7e625..9f6b3bc 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -69,8 +69,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/alerts.html b/templates/alerts.html index 424bbce..7fa84dc 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -56,8 +56,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/bands.html b/templates/bands.html index c28dae8..e0f1f5a 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -62,9 +62,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index e8883b3..3e6f30f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -46,10 +46,10 @@ crossorigin="anonymous"> - - - - + + + + diff --git a/templates/conditions.html b/templates/conditions.html index cf8ad03..7ce629e 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -189,8 +189,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/map.html b/templates/map.html index cba0a09..4d70953 100644 --- a/templates/map.html +++ b/templates/map.html @@ -70,9 +70,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/spots.html b/templates/spots.html index 17bdd33..89c4c2f 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -87,9 +87,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/status.html b/templates/status.html index 9ad2aa2..1ca8ced 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,8 +59,8 @@ - - + + diff --git a/webassets/js/conditions.js b/webassets/js/conditions.js index 10dd7ce..fb0fa80 100644 --- a/webassets/js/conditions.js +++ b/webassets/js/conditions.js @@ -108,18 +108,6 @@ function loadSolarConditions() { }); } -// Take a normalised number 0-1 and generate a background colour for the DX stats cells -function dxStatsColor(t) { - const yellow = [255, 243, 205]; - const green = [209, 231, 221]; - if (t == 0.0) { - return "rgb(248, 215, 218)"; - } else { - const ch = (i) => Math.round(yellow[i] + (green[i] - yellow[i]) * t); - return `rgb(${ch(0)}, ${ch(1)}, ${ch(2)})`; - } -} - // Render the DX stats table for the currently selected DE continent function renderDxStats() { if (!dxStatsData) { return; } @@ -142,7 +130,8 @@ function renderDxStats() { const range = max - min; cells.forEach(function({ cell, count }) { const t = range > 0 ? (count - min) / range : 0; - cell.css('background-color', dxStatsColor(t)); + const cls = t === 0 ? 'table-danger' : t < 0.05 ? 'table-warning' : 'table-success'; + cell.removeClass('table-danger table-warning table-success').addClass(cls); }); }