diff --git a/website/src/components/DataGrid.astro b/website/src/components/DataGrid.astro index 17e6822..e46365e 100644 --- a/website/src/components/DataGrid.astro +++ b/website/src/components/DataGrid.astro @@ -105,10 +105,14 @@ Astro.response.headers.set('Cache-Control', 'no-cache'); }; const def = map[currentColumnID]; if (def) { - if (params.value <= def.bestPerformance) { - return {backgroundColor: style.getPropertyValue('--good-color')}; - } else if (params.value >= def.worstPerformance) { - return {backgroundColor: style.getPropertyValue('--bad-color')}; + const isGood = def.worstPerformance > def.bestPerformance ? + params.value < def.bestPerformance : params.value > def.bestPerformance; + const isBad = def.worstPerformance > def.bestPerformance ? + params.value > def.worstPerformance : params.value < def.worstPerformance; + if (isGood) { + return { backgroundColor: style.getPropertyValue('--good-color') }; + } else if (isBad) { + return { backgroundColor: style.getPropertyValue('--bad-color') }; } } return {};