@@ -78,7 +78,29 @@ const LABEL_COLORS = [
7878 { bg : 'bg-stone-100' , text : 'text-stone-700' , border : 'border-stone-300' } ,
7979] ;
8080
81- const TAG_COLOR = { bg : 'bg-stone-100' , text : 'text-stone-700' , arrow : 'border-r-stone-100' } ;
81+ // Tag color palette (same as labels)
82+ const TAG_COLORS = [
83+ { bg : 'bg-blue-100' , text : 'text-blue-700' , arrow : 'border-r-blue-100' } ,
84+ { bg : 'bg-green-100' , text : 'text-green-700' , arrow : 'border-r-green-100' } ,
85+ { bg : 'bg-purple-100' , text : 'text-purple-700' , arrow : 'border-r-purple-100' } ,
86+ { bg : 'bg-orange-100' , text : 'text-orange-700' , arrow : 'border-r-orange-100' } ,
87+ { bg : 'bg-pink-100' , text : 'text-pink-700' , arrow : 'border-r-pink-100' } ,
88+ { bg : 'bg-cyan-100' , text : 'text-cyan-700' , arrow : 'border-r-cyan-100' } ,
89+ { bg : 'bg-indigo-100' , text : 'text-indigo-700' , arrow : 'border-r-indigo-100' } ,
90+ { bg : 'bg-teal-100' , text : 'text-teal-700' , arrow : 'border-r-teal-100' } ,
91+ { bg : 'bg-amber-100' , text : 'text-amber-700' , arrow : 'border-r-amber-100' } ,
92+ { bg : 'bg-rose-100' , text : 'text-rose-700' , arrow : 'border-r-rose-100' } ,
93+ { bg : 'bg-violet-100' , text : 'text-violet-700' , arrow : 'border-r-violet-100' } ,
94+ { bg : 'bg-lime-100' , text : 'text-lime-700' , arrow : 'border-r-lime-100' } ,
95+ { bg : 'bg-fuchsia-100' , text : 'text-fuchsia-700' , arrow : 'border-r-fuchsia-100' } ,
96+ { bg : 'bg-emerald-100' , text : 'text-emerald-700' , arrow : 'border-r-emerald-100' } ,
97+ { bg : 'bg-sky-100' , text : 'text-sky-700' , arrow : 'border-r-sky-100' } ,
98+ { bg : 'bg-red-100' , text : 'text-red-700' , arrow : 'border-r-red-100' } ,
99+ { bg : 'bg-yellow-100' , text : 'text-yellow-700' , arrow : 'border-r-yellow-100' } ,
100+ { bg : 'bg-slate-100' , text : 'text-slate-700' , arrow : 'border-r-slate-100' } ,
101+ { bg : 'bg-zinc-100' , text : 'text-zinc-700' , arrow : 'border-r-zinc-100' } ,
102+ { bg : 'bg-stone-100' , text : 'text-stone-700' , arrow : 'border-r-stone-100' } ,
103+ ] ;
82104
83105const PAGE_SIZE = 10 ;
84106
@@ -129,6 +151,30 @@ export function ExperimentsPage() {
129151 return colorMap ;
130152 } , [ experiments ] ) ;
131153
154+ // Create a stable color mapping for tags (offset by 10 to avoid label colors)
155+ const tagColorMap = useMemo ( ( ) => {
156+ if ( ! experiments || experiments . length === 0 ) {
157+ return new Map < string , typeof TAG_COLORS [ 0 ] > ( ) ;
158+ }
159+
160+ const uniqueTags = new Set < string > ( ) ;
161+ experiments . forEach ( exp => {
162+ exp . tags ?. forEach ( tag => {
163+ uniqueTags . add ( tag ) ;
164+ } ) ;
165+ } ) ;
166+
167+ const sortedTags = Array . from ( uniqueTags ) . sort ( ) ;
168+ const colorMap = new Map < string , typeof TAG_COLORS [ 0 ] > ( ) ;
169+
170+ // Offset by 10 so tags use different colors from labels
171+ sortedTags . forEach ( ( tag , index ) => {
172+ colorMap . set ( tag , TAG_COLORS [ ( index + 10 ) % TAG_COLORS . length ] ) ;
173+ } ) ;
174+
175+ return colorMap ;
176+ } , [ experiments ] ) ;
177+
132178 // Build label options grouped by key, showing all unique values per key
133179 const labelOptions = useMemo ( ( ) => {
134180 if ( ! experiments || experiments . length === 0 ) {
@@ -447,17 +493,20 @@ export function ExperimentsPage() {
447493 < TableCell className = "py-3 text-sm" >
448494 { experiment . tags && experiment . tags . length > 0 ? (
449495 < div className = "flex flex-wrap gap-x-1 gap-y-1" >
450- { experiment . tags . map ( ( tag , idx ) => (
451- < span key = { idx } className = "inline-flex items-stretch" >
452- < span
453- className = { `border-y-[10px] border-y-transparent border-r-[7px] ${ TAG_COLOR . arrow } ` }
454- style = { { width : 0 } }
455- />
456- < span className = { `inline-flex items-center text-xs pl-1 pr-1.5 ${ TAG_COLOR . bg } ${ TAG_COLOR . text } rounded-r-sm font-medium` } >
457- { tag }
496+ { experiment . tags . map ( ( tag , idx ) => {
497+ const colors = tagColorMap . get ( tag ) || TAG_COLORS [ 0 ] ;
498+ return (
499+ < span key = { idx } className = "inline-flex items-stretch" >
500+ < span
501+ className = { `border-y-[10px] border-y-transparent border-r-[7px] ${ colors . arrow } ` }
502+ style = { { width : 0 } }
503+ />
504+ < span className = { `inline-flex items-center text-xs pl-1 pr-1.5 ${ colors . bg } ${ colors . text } rounded-r-sm font-medium` } >
505+ { tag }
506+ </ span >
458507 </ span >
459- </ span >
460- ) ) }
508+ ) ;
509+ } ) }
461510 </ div >
462511 ) : (
463512 < span className = "text-muted-foreground" > -</ span >
0 commit comments