MCPcopy Create free account
hub / github.com/BrainicHQ/DoHSpeedTest / colorTableRows

Function colorTableRows

script.js:932–953  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

930}
931
932function colorTableRows() {
933 const servers = dnsServers.filter(s => s.speed && typeof s.speed.avg === 'number');
934 if (servers.length === 0) return;
935
936 const avgs = servers.map(s => s.speed.avg);
937 const minAvg = Math.min(...avgs);
938 const maxAvg = Math.max(...avgs);
939 const range = maxAvg - minAvg || 1;
940
941 servers.forEach(server => {
942 const row = findResultRow(server);
943 if (!row) return;
944 const norm = (server.speed.avg - minAvg) / range;
945 if (norm <= 0.33) row.style.borderLeftColor = '#22c55e';
946 else if (norm <= 0.66) row.style.borderLeftColor = '#eab308';
947 else row.style.borderLeftColor = '#ef4444';
948
949 if (server.reliability && server.reliability.status === 'failed') {
950 row.style.borderLeftColor = '#94a3b8';
951 }
952 });
953}
954
955// ─── Table Sorting ───────────────────────────────────────────────────────────
956

Callers 1

showTopResultsFunction · 0.85

Calls 1

findResultRowFunction · 0.85

Tested by

no test coverage detected