21 lines
535 B
TypeScript
21 lines
535 B
TypeScript
|
|
"use client";
|
||
|
|
import resolveConfig from "tailwindcss/resolveConfig";
|
||
|
|
import tailwindConfig from "../../tailwind.config";
|
||
|
|
|
||
|
|
function getMagnitudeColour(magnitude: number) {
|
||
|
|
const fullConfig = resolveConfig(tailwindConfig);
|
||
|
|
const colors = fullConfig.theme.colors;
|
||
|
|
|
||
|
|
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];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default getMagnitudeColour;
|