tremor-tracker/src/utils/getMagnitudeColour.tsx

22 lines
521 B
TypeScript
Raw Normal View History

2025-03-23 15:24:10 +00:00
"use client";
import resolveConfig from "tailwindcss/resolveConfig";
2025-05-04 16:04:44 +01:00
2025-03-23 15:24:10 +00:00
import tailwindConfig from "../../tailwind.config";
function getMagnitudeColour(magnitude: number) {
2025-05-04 16:04:44 +01:00
const fullConfig = resolveConfig(tailwindConfig);
const colors = fullConfig.theme.colors;
2025-03-23 15:24:10 +00:00
2025-05-04 16:04:44 +01:00
if (magnitude >= 7) {
return colors["red"][600];
} else if (magnitude >= 5) {
return colors["orange"][500];
} else if (magnitude >= 3) {
return colors["amber"][500];
} else {
return colors["blue"][400];
}
2025-03-23 15:24:10 +00:00
}
export default getMagnitudeColour;