34a45f462f1b0e73015f60354ded50644bf629b7
braney
  Wed Apr 15 13:03:18 2026 -0700
Apply colorOverride to track labels; add right-click "Change Track Color" dialog, refs #20460

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index e383b57baf8..1d225e1dec2 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -1353,30 +1353,31 @@
 /* for sample tracks */
 double minRangeCutoff, maxRangeCutoff;
 double minRange, maxRange;
 double min0, max0;
 char minRangeStr[32];
 char maxRangeStr[32];
 
 int ymin, ymax;
 int newy;
 char o4[256];
 char o5[256];
 struct slList *item;
 enum trackVisibility vis = track->limitedVis;
 Color labelColor = (track->labelColor ?
                         track->labelColor : track->ixColor);
+labelColor = colorFromCart(track, labelColor);
 labelColor = maybeDarkerLabels(track, hvg, labelColor);
 int fontHeight = mgFontLineHeight(font);
 int tHeight = trackPlusLabelHeight(track, fontHeight);
 if (vis == tvHide)
     return y;
 
 /*  if a track can do its own left labels, do them after drawItems */
 if (track->drawLeftLabels != NULL)
     return y + tHeight;
 
 /*  Wiggle tracks depend upon clipping.  They are reporting
  *  totalHeight artifically high by 1 so this will leave a
  *  blank area one pixel high below the track.
  */
 if (sameString("wig",track->tdb->type) || sameString("bedGraph",track->tdb->type))
@@ -1643,30 +1644,31 @@
 /* Draw center labels.  Return y coord */
 {
 if (track->limitedVis != tvHide)
     {
     MgFont *labelfont;
     if (isCenterLabelIncluded(track))
         {
         int trackPastTabX = (withLeftLabels ? trackTabWidth : 0);
         int trackPastTabWidth = tl.picWidth - trackPastTabX;
         int fontHeight = mgFontLineHeight(font);
         int insideHeight = fontHeight-1;
 	boolean toggleDone = FALSE;
         char *label = track->longLabel;
         Color labelColor = (track->labelColor ?
                             track->labelColor : track->ixColor);
+        labelColor = colorFromCart(track, labelColor);
         if (isCenterLabelConditional(track))
             {
             struct trackDb* tdbComposite = tdbGetComposite(track->tdb);
             if (tdbComposite != NULL)
                 {
                 label = tdbComposite->longLabel;
                 labelColor = hvGfxFindColorIx(hvg, tdbComposite->colorR,
                                                 tdbComposite->colorG, tdbComposite->colorB);
 
                 // under this condition the characters that have descenders end up bleeding
                 // over into tracks that don't actually draw the label which 
                 // results in grek.  In this condition make the center label font smaller
                 int fontsize = findBiggest(fontHeight - 4);
                 char size[1024];
                 safef(size, sizeof size, "%d", fontsize);
@@ -1821,30 +1823,31 @@
  * totalHeight()... I think the least disruptive way to account for this
  * (and not touch Ryan Weber's Sample stuff) is to just correct here if
  * we see wiggle or bedGraph: */
 if (isWig)
     y++;
 return y;
 }
 
 static int doOwnLeftLabels(struct track *track, struct hvGfx *hvg,
                                                 MgFont *font, int y)
 /* Track draws it own, custom left labels */
 {
 int fontHeight = mgFontLineHeight(font);
 int tHeight = trackPlusLabelHeight(track, fontHeight);
 Color labelColor = (track->labelColor ? track->labelColor : track->ixColor);
+labelColor = colorFromCart(track, labelColor);
 labelColor = maybeDarkerLabels(track, hvg, labelColor);
 hvGfxSetClip(hvg, leftLabelX, y, leftLabelWidth, tHeight);
 track->drawLeftLabels(track, winStart, winEnd,
 		      hvg, leftLabelX, y, leftLabelWidth, tHeight,
                       isCenterLabelIncluded(track), font, labelColor,
 		      track->limitedVis);
 hvGfxUnclip(hvg);
 y += tHeight;
 return y;
 }
 
 // defined below:
 static int getMaxWindowToDraw(struct trackDb *tdb);
 
 int doTrackMap(struct track *track, struct hvGfx *hvg, int y, int fontHeight,