From da70d070517a95abeb22e1ec0cb2e60d1a99b18e Mon Sep 17 00:00:00 2001 From: gorkem-bwl Date: Sun, 26 Apr 2026 01:22:06 -0400 Subject: [PATCH] chore(client): document MUI default fallbacks in getResponseColor Annotate the hex literals used when callers omit theme colours so the intent (defensive MUI default match) is obvious instead of looking like arbitrary values. --- client/src/Utils/DataUtils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/Utils/DataUtils.ts b/client/src/Utils/DataUtils.ts index c0bbb2d2a..40bbd1b8b 100644 --- a/client/src/Utils/DataUtils.ts +++ b/client/src/Utils/DataUtils.ts @@ -56,10 +56,12 @@ export const getResponseColor = ( // 0–300ms: interpolate start (good) -> mid (warning) // 300–600ms: interpolate mid (warning) -> end (error) // >600ms: solid end (error) + // MUI default success/warning/error.main values, used only when the caller + // fails to pass theme colors (defensive — keeps the gradient meaningful). const safe = { ...colors }; - if (!safe.start) safe.start = "#4caf50"; // fallback green - if (!safe.mid) safe.mid = "#ff9800"; // fallback orange - if (!safe.end) safe.end = "#f44336"; // fallback red + if (!safe.start) safe.start = "#4caf50"; + if (!safe.mid) safe.mid = "#ff9800"; + if (!safe.end) safe.end = "#f44336"; const toHex = (c: number) => c.toString(16).padStart(2, "0"); const clamp = (n: number) => Math.min(255, Math.max(0, Math.round(n)));