c04aef0e2bfd567e281ddd1af11b3e878ff4dde5
angie
  Wed Oct 31 15:27:53 2018 -0700
Use hvGfxContrastingColor() instead of whiteIndex() for base coloring text so it's not invisible on light-colored PSL tracks.

diff --git src/hg/hgTracks/cds.c src/hg/hgTracks/cds.c
index bb28cb3..17d72fa 100644
--- src/hg/hgTracks/cds.c
+++ src/hg/hgTracks/cds.c
@@ -62,69 +62,70 @@
                                         int height, Color color, int score,
                                         MgFont *font, char *text, bool zoomed,
                                         int winStart, int maxPixels, boolean isCoding, boolean justifyString)
 /* Draw a box scaled from chromosome to window coordinates with
    a codon or set of 3 or less bases drawn in the box. */
 {
 
 /*first draw the box itself*/
 drawScaledBox(hvg, chromStart, chromEnd, scale, xOff, y, height, 
 		    color);
 
 /*draw text in box if space, and align properly for codons or DNA*/
 if (zoomed)
     {
     int i;
+    Color textColor = hvGfxContrastingColor(hvg, color);
     int x1, x2, w;
     x1 = round((double)(chromStart-winStart)*scale) + xOff;
     x2 = round((double)(chromEnd-winStart)*scale) + xOff;
     if (x2 >= maxPixels)
         x2 = maxPixels - 1;
     w = x2-x1;
     if (w < 1)
         w = 1;
 
     if (chromEnd - chromStart == 3 && isCoding)
         {
         if (justifyString)
-            spreadBasesString(hvg, x1, y, w, height, whiteIndex(),  font, text, strlen(text),  TRUE);
+            spreadBasesString(hvg, x1, y, w, height, textColor,  font, text, strlen(text),  TRUE);
         else
-            hvGfxTextCentered(hvg, x1, y, w, height, whiteIndex(), font, text);
+            hvGfxTextCentered(hvg, x1, y, w, height, textColor, font, text);
         }
     else if (chromEnd - chromStart < 3 && isCoding)
         {
         if (justifyString)
             spreadBasesString(hvg, x1, y, w, height, cdsColor[CDS_PARTIAL_CODON], font, text, strlen(text), TRUE);
         else
             hvGfxTextCentered(hvg, x1, y, w, height, cdsColor[CDS_PARTIAL_CODON], font, text);
         }
     else
         {
         int thisX,thisX2;
         char c[2];
 	c[1] = '\0';
 	int iMin = max(0, (winStart-chromStart));
 	int iMax = min((chromEnd-chromStart), (winEnd-chromStart));
         for (i=iMin; i<iMax; i++)
             {
 	    if (text[i] == ' ')
 		continue;
             c[0] = text[i];
             thisX = round((double)(chromStart+i-winStart)*scale) + xOff;
             thisX2 = round((double)(chromStart+1+i-winStart)*scale) + xOff;
             hvGfxTextCentered(hvg, thisX, y, thisX2-thisX, height,
-			   whiteIndex(),font,c);
+			   textColor,font,c);
             }
         }
     }
 }
 
 static int convertCoordUsingPsl( int s, struct psl *psl )
 /*return query position corresponding to target position in one 
  * of the coding blocks of a psl file, or return -1 if target position
  * is not in an exon of this psl entry*/
 {
 int i;
 int idx = -1;
 unsigned *qStarts = psl->qStarts;
 unsigned tStart = 0;
 unsigned thisQStart = 0;