ab7847c47ac5507a7e126691bb78826ed4ba345d
chmalee
  Mon Sep 13 16:34:47 2021 -0700
Staging GTEx single nuclei gene expression track, refs #29954

diff --git src/hg/hgc/facetedBar.c src/hg/hgc/facetedBar.c
index 9fa05c5..4e2c18b 100644
--- src/hg/hgc/facetedBar.c
+++ src/hg/hgc/facetedBar.c
@@ -5,49 +5,61 @@
 #include "hvGfx.h"
 #include "trashDir.h"
 #include "hCommon.h"
 #include "hui.h"
 #include "asParse.h"
 #include "hgc.h"
 #include "trackHub.h"
 #include "hgColors.h"
 #include "fieldedTable.h"
 #include "tablesTables.h"
 #include "facetField.h"
 #include "barChartBed.h"
 #include "hgConfig.h"
 #include "facetedTable.h"
 #include "facetedBar.h"
+#include "htmlColor.h"
 
 
 struct wrapContext
 /* Context used by various wrappers. */
     {
     int colorIx;    /* Index of color in row */
     int valIx;	    /* Where value lives */
     double maxVal;/* Maximum of any total value */
     };
 
 void wrapVal(struct fieldedTable *table, struct fieldedRow *row,
     char *field, char *val, char *shortVal, void *context)
 /* Write out wrapper draws a SVG bar*/
 {
 struct wrapContext *wc = context;
 char *color = "#000000";    // Black is default color if no color column
+unsigned rgb;
 int colorIx = wc->colorIx;
 if (colorIx >= 0)
+    {
     color = row->row[colorIx];
+    /* try r,g,b */
+    if (index(color, ','))
+        {
+        unsigned char r, g, b;
+        parseColor(color, &r, &g, &b);
+        htmlColorFromRGB(&rgb, r, g, b);
+        color = htmlColorToCode(rgb);
+        }
+    }
 double x = sqlDouble(val);
 int width = 500, height = 13;  // These are units of ~2010 pixels or something
 double barWidth = (double)width*x/wc->maxVal;
 printf("<svg width=\"%g\" height=\"%d\">", barWidth, height);
 printf("<rect width=\"%g\" height=\"%d\" style=\"fill:%s\">", 
     barWidth, height, color);
 printf("</svg>");
 printf(" %6.2f", x);
 }
 
 struct fieldedTable *addChartVals(struct fieldedTable *table, struct barChartBed *chart)
 /* All a new column with chart values */
 {
 if (chart->expCount != table->rowCount)
     errAbort("Mismatch in field counts between %s (%d) and barChartBed (%d)",