2025-06-29 20:44:33 -04:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2025-09-10 10:57:07 -07:00
|
|
|
import { theme } from '../semantic-colors.js';
|
2025-06-29 20:44:33 -04:00
|
|
|
|
|
|
|
|
// --- Thresholds ---
|
|
|
|
|
export const TOOL_SUCCESS_RATE_HIGH = 95;
|
|
|
|
|
export const TOOL_SUCCESS_RATE_MEDIUM = 85;
|
|
|
|
|
|
|
|
|
|
export const USER_AGREEMENT_RATE_HIGH = 75;
|
|
|
|
|
export const USER_AGREEMENT_RATE_MEDIUM = 45;
|
|
|
|
|
|
|
|
|
|
export const CACHE_EFFICIENCY_HIGH = 40;
|
|
|
|
|
export const CACHE_EFFICIENCY_MEDIUM = 15;
|
|
|
|
|
|
|
|
|
|
// --- Color Logic ---
|
|
|
|
|
export const getStatusColor = (
|
|
|
|
|
value: number,
|
2025-09-29 15:42:33 -07:00
|
|
|
thresholds: { green: number; yellow: number; red?: number },
|
2025-06-29 20:44:33 -04:00
|
|
|
options: { defaultColor?: string } = {},
|
|
|
|
|
) => {
|
|
|
|
|
if (value >= thresholds.green) {
|
2025-09-10 10:57:07 -07:00
|
|
|
return theme.status.success;
|
2025-06-29 20:44:33 -04:00
|
|
|
}
|
|
|
|
|
if (value >= thresholds.yellow) {
|
2025-09-10 10:57:07 -07:00
|
|
|
return theme.status.warning;
|
2025-06-29 20:44:33 -04:00
|
|
|
}
|
2025-09-29 15:42:33 -07:00
|
|
|
if (thresholds.red != null && value >= thresholds.red) {
|
|
|
|
|
return theme.status.error;
|
|
|
|
|
}
|
2025-09-25 15:12:10 -07:00
|
|
|
return options.defaultColor ?? theme.status.error;
|
2025-06-29 20:44:33 -04:00
|
|
|
};
|