mirror of
https://github.com/coder/coder.git
synced 2026-11-13 14:19:24 +08:00
17 lines
394 B
TypeScript
17 lines
394 B
TypeScript
import type { Theme } from "@emotion/react";
|
|
|
|
export const getLatencyColor = (theme: Theme, latency?: number) => {
|
|
if (!latency) {
|
|
return theme.palette.text.secondary;
|
|
}
|
|
|
|
let color = theme.roles.success.fill.solid;
|
|
|
|
if (latency >= 150 && latency < 300) {
|
|
color = theme.roles.warning.fill.solid;
|
|
} else if (latency >= 300) {
|
|
color = theme.roles.error.fill.solid;
|
|
}
|
|
return color;
|
|
};
|