Skip to content

Commit 57b328f

Browse files
refactor(ui): map hardcoded Tailwind palette classes onto semantic tokens (#37576)
* refactor(ui): map hardcoded Tailwind palette classes onto semantic tokens The dashboard painted itself with literal palette utilities (text-gray-500, bg-blue-50, border-red-200) that resolve to one fixed color regardless of theme, so the shadcn token layer and its .dark block could never take effect. A codemod (scripts/codemod-color-tokens.mjs) rewrites 3,232 of those across 254 files onto the existing token scale: neutrals become foreground / muted-foreground / muted / border / card, and red, green, amber and blue collapse into destructive, success, warning and info, with the pale -50 to -300 tints expressed as opacity modifiers on the same token. Hover and focus variants map to accent so they lift rather than recess. 210 now-redundant dark: variants are dropped since the tokens carry both modes. The .dark palette is retuned to a neutral gray ramp with the sidebar recessed below the content canvas, replacing the blue-tinted shadcn default where the sidebar read as a full-height card floating on a near-black page. Nothing sets the .dark class yet, so light mode is unchanged and dark mode stays inert until a theme toggle lands. * chore(ui): drop the one-shot color-token codemod script
1 parent 7b574b9 commit 57b328f

256 files changed

Lines changed: 2460 additions & 2424 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ui/litellm-dashboard/src/app/(dashboard)/access-groups/_components/AccessGroupsTableColumns.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ interface ResourceTone {
2222
}
2323

2424
const RESOURCE_TONES: Record<"models" | "mcpServers" | "agents", ResourceTone> = {
25-
models: { icon: Layers, className: "bg-blue-50 text-blue-700 ring-blue-600/20" },
26-
mcpServers: { icon: Server, className: "bg-cyan-50 text-cyan-700 ring-cyan-600/20" },
25+
models: { icon: Layers, className: "bg-info/10 text-info ring-blue-600/20" },
26+
mcpServers: { icon: Server, className: "bg-info/10 text-info ring-cyan-600/20" },
2727
agents: { icon: Bot, className: "bg-purple-50 text-purple-700 ring-purple-600/20" },
2828
};
2929

ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const AgentsTable: React.FC<AgentsTableProps> = ({
7373
render={
7474
<div className="flex items-center gap-2">
7575
<CircleCheck
76-
className={healthCheckEnabled ? "size-4 text-green-500" : "size-4 text-muted-foreground"}
76+
className={healthCheckEnabled ? "size-4 text-success" : "size-4 text-muted-foreground"}
7777
/>
7878
<span className="text-sm text-muted-foreground">Health Check</span>
7979
<Switch

ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const AgentTypeLabel: React.FC<{ agentType: string; info: AgentCreateInfo | unde
7272
if (agentType === CUSTOM_AGENT_TYPE) {
7373
return (
7474
<span className="flex items-center gap-2">
75-
<LayoutGrid className="size-4 text-amber-600 dark:text-amber-400" />
75+
<LayoutGrid className="size-4 text-warning" />
7676
<span>Custom / Other</span>
7777
</span>
7878
);
@@ -588,7 +588,7 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
588588
<h4 className="mb-3 text-sm font-medium text-foreground">Budgets &amp; Rate Limits</h4>
589589
<div className="space-y-4">
590590
{!requireTraceIdOutbound && (
591-
<div className="rounded-lg border border-yellow-200 bg-yellow-50 p-3 text-sm text-yellow-800 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300">
591+
<div className="rounded-lg border border-warning/20 bg-warning/10 p-3 text-sm text-warning">
592592
Enable &quot;Require x-litellm-trace-id on calls BY this agent&quot; in Tracing to configure budgets and
593593
rate limits.
594594
</div>
@@ -758,20 +758,17 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
758758
<div className="mb-1 px-2 text-xs font-medium tracking-wide text-muted-foreground uppercase">
759759
Not listed?
760760
</div>
761-
<SelectItem
762-
value={CUSTOM_AGENT_TYPE}
763-
className="focus:bg-amber-50 dark:focus:bg-amber-950 dark:focus:**:text-amber-400"
764-
>
761+
<SelectItem value={CUSTOM_AGENT_TYPE} className="focus:bg-warning/10 dark:focus:**:text-amber-400">
765762
<span className="flex items-center gap-3">
766-
<LayoutGrid className="size-4.5 shrink-0 text-amber-600 dark:text-amber-400" />
763+
<LayoutGrid className="size-4.5 shrink-0 text-warning" />
767764
<span className="block">
768765
<span className="flex items-center gap-2">
769-
<span className="font-medium text-amber-700 dark:text-amber-400">Custom / Other</span>
766+
<span className="font-medium text-warning">Custom / Other</span>
770767
<Badge variant="warning" className="h-4 px-1 text-[10px]">
771768
GENERIC
772769
</Badge>
773770
</span>
774-
<span className="block text-xs whitespace-normal text-amber-600 dark:text-amber-400">
771+
<span className="block text-xs whitespace-normal text-warning">
775772
For agents that don&apos;t follow a standard protocol, just needs a virtual key
776773
</span>
777774
</span>
@@ -880,7 +877,7 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
880877
<div>
881878
{/* Agent name chip */}
882879
<div className="mb-6 flex justify-center">
883-
<Badge className="h-auto gap-1.5 bg-purple-100 px-3 py-1 text-sm text-purple-700 dark:bg-purple-950 dark:text-purple-300">
880+
<Badge className="h-auto gap-1.5 bg-purple-100 px-3 py-1 text-sm text-purple-700">
884881
<Bot className="size-3.5" />
885882
{agentName}
886883
</Badge>
@@ -909,7 +906,7 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
909906
<div
910907
className={`cursor-pointer rounded-lg border-2 p-4 transition-colors ${
911908
keyAssignOption === "create_new"
912-
? "border-indigo-600 bg-indigo-50 dark:border-indigo-400 dark:bg-indigo-950"
909+
? "border-indigo-600 bg-indigo-50"
913910
: "border-border bg-background hover:border-muted-foreground/40"
914911
}`}
915912
onClick={() => setKeyAssignOption("create_new")}
@@ -919,7 +916,7 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
919916
<RadioGroupItem value="create_new" aria-label="Create a new key for this agent" />
920917
<div className="flex-1">
921918
<div className="flex items-center gap-2">
922-
<Key className="size-4 text-indigo-600 dark:text-indigo-400" />
919+
<Key className="size-4 text-indigo-600" />
923920
<span className="font-medium text-foreground">Create a new key for this agent</span>
924921
</div>
925922
<p className="mt-1 text-sm text-muted-foreground">A dedicated key scoped to this agent.</p>
@@ -946,7 +943,7 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
946943
<div
947944
className={`cursor-pointer rounded-lg border-2 p-4 transition-colors ${
948945
keyAssignOption === "existing_key"
949-
? "border-indigo-600 bg-indigo-50 dark:border-indigo-400 dark:bg-indigo-950"
946+
? "border-indigo-600 bg-indigo-50"
950947
: "border-border bg-background hover:border-muted-foreground/40"
951948
}`}
952949
onClick={() => setKeyAssignOption("existing_key")}
@@ -993,10 +990,10 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
993990

994991
const renderReadyStep = () => (
995992
<div className="py-6 text-center">
996-
<CircleCheck className="mb-4 size-12 text-green-500" />
993+
<CircleCheck className="mb-4 size-12 text-success" />
997994
<h3 className="mb-2 text-xl font-semibold text-foreground">Agent Created!</h3>
998995
<div className="mb-4 flex justify-center">
999-
<Badge className="h-auto gap-1.5 bg-purple-100 px-3 py-1 text-sm text-purple-700 dark:bg-purple-950 dark:text-purple-300">
996+
<Badge className="h-auto gap-1.5 bg-purple-100 px-3 py-1 text-sm text-purple-700">
1000997
<Bot className="size-3.5" />
1001998
{createdAgentName}
1002999
</Badge>

ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_card_discovery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ const AgentCardDiscovery: React.FC<AgentCardDiscoveryProps> = ({
334334
{card && (
335335
<div className="mt-4 rounded-lg border border-border bg-background p-4">
336336
<div className="mb-3 flex flex-wrap items-center gap-2">
337-
<CircleCheck className="size-4 text-green-600" />
337+
<CircleCheck className="size-4 text-success" />
338338
<span className="text-sm font-medium text-foreground">Upstream card loaded</span>
339339
{card.version && <Badge variant="secondary">v{card.version}</Badge>}
340340
{card.provider?.organization && <Badge variant="secondary">{card.provider.organization}</Badge>}

ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessT
278278
Back to Agents
279279
</Button>
280280
<h1 className="text-2xl font-semibold">{agent.agent_name || "Unnamed Agent"}</h1>
281-
<p className="text-sm text-gray-500 font-mono">{agent.agent_id}</p>
281+
<p className="text-sm text-muted-foreground font-mono">{agent.agent_id}</p>
282282
</div>
283283

284284
<Tabs value={activeTab} onValueChange={setActiveTab}>

ui/litellm-dashboard/src/app/(dashboard)/api-reference/_components/DocLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const DocLink = ({ href, className }: DocLinkProps) => {
1616
rel="noopener noreferrer"
1717
title="Open documentation in a new tab"
1818
className={cn(
19-
"inline-flex items-center gap-2 rounded-xl border border-zinc-200 bg-white/80 px-3.5 py-2 text-sm font-medium text-zinc-700 shadow-xs",
20-
"hover:bg-white focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-500 active:translate-y-[0.5px]",
19+
"inline-flex items-center gap-2 rounded-xl border border-border bg-white/80 px-3.5 py-2 text-sm font-medium text-foreground shadow-xs",
20+
"hover:bg-card focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring active:translate-y-[0.5px]",
2121
className,
2222
)}
2323
>

ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_health.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ const HealthCheckDetails: React.FC<{ response: any }> = ({ response }) => {
168168
<div>
169169
<div className="mb-6 flex items-center">
170170
{response?.status === "healthy" ? (
171-
<CheckCircle2 className="mr-2 size-5 text-green-600" />
171+
<CheckCircle2 className="mr-2 size-5 text-success" />
172172
) : (
173173
<XCircle className="mr-2 size-5 text-destructive" />
174174
)}
175175
<p
176-
className={`text-sm font-medium ${response?.status === "healthy" ? "text-green-600" : "text-destructive"}`}
176+
className={`text-sm font-medium ${response?.status === "healthy" ? "text-success" : "text-destructive"}`}
177177
>
178178
Cache Status: {response?.status || "unhealthy"}
179179
</p>

ui/litellm-dashboard/src/app/(dashboard)/caching/_components/coordination_redis_settings/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const CoordinationRedisSettings: React.FC = () => {
107107
manager. It is configured independently of the response cache.
108108
</p>
109109
<p className="text-xs text-muted-foreground">{badge.tooltip}</p>
110-
<p className="text-xs text-amber-600 dark:text-amber-400">Saved changes take effect on proxy restart.</p>
110+
<p className="text-xs text-warning">Saved changes take effect on proxy restart.</p>
111111
</div>
112112

113113
<CoordinationRedisTypeSelector redisType={redisType} onTypeChange={setSelectedRedisType} />

ui/litellm-dashboard/src/app/(dashboard)/caching/_components/response_time_indicator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const ResponseTimeIndicator: React.FC<ResponseTimeIndicatorProps> = ({ re
88
if (responseTimeMs === null || responseTimeMs === undefined) return null;
99

1010
return (
11-
<div className="flex items-center space-x-1 text-xs text-gray-500 font-mono">
11+
<div className="flex items-center space-x-1 text-xs text-muted-foreground font-mono">
1212
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1313
<path
1414
d="M12 6V12L16 14M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z"

ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const HeroCard: React.FC<{ view: BenchmarkView }> = ({ view }) => {
6262
<p className="text-5xl font-semibold tracking-tight text-foreground">{usd(stats.saved_spend)}</p>
6363
<Badge
6464
variant="secondary"
65-
className={cheaper ? "bg-emerald-50 text-emerald-700" : "bg-red-50 text-destructive"}
65+
className={cheaper ? "bg-success/10 text-success" : "bg-destructive/10 text-destructive"}
6666
>
6767
{stats.saved_spend !== 0 && (cheaper ? "-" : "+")}
6868
{Math.abs(stats.saved_pct).toFixed(0)}%

0 commit comments

Comments
 (0)