53a8c1ac1513a14c299dc27940a45d97e6e5456f braney Tue Sep 8 09:33:22 2026 -0700 bedItemRgb: let an explicit "itemRgb on" beat the presence of a "color" setting A stanza could once say both "itemRgb on" and "color" and get both: items drawn from the file's own RGB column, labels drawn in the color setting. Since 2025 the color setting wins outright and the two tracks in Gerardo's test hub, one with "color" alone and one with both settings, render identically. The cause is the order of the tests in bedItemRgb(), not a missing feature. The "color" test is only about whether to turn itemRgb on by DEFAULT, but it sat in the same early return as the "itemRgb off" test, above the test for an explicit "itemRgb on" -- so that test was unreachable for any stanza that set a color, and an explicit setting could be overridden by the mere presence of one. 5448842337e added the color rule while a later block still honoured an explicit setting; 88d620e6c82 folded the two tests together and dropped that block; c54077c4044 added it back, but below the color test. Moving the color test below both explicit tests restores the old behavior. Only one of the four cases changes: "itemRgb on" plus "color" now returns TRUE. "itemRgb off" still returns FALSE, "color" alone still suppresses the default, and a stanza that says neither still follows the alwaysItemRgb hg.conf default. The label keeps taking its color from the color setting either way, since that comes from colorFromCart() rather than from here. Measured before and after with a four-track hub whose items all carry a pure blue itemRgb column and whose color settings are pure green: the both-settings track went from green items to blue items, with its center label green throughout. The other three tracks are unchanged. A Docent regression test asserts all four rows, kent/src/hg/utils/docent/tests/regress/rm36212.xfail.docent.yaml. refs #36212 diff --git src/hg/cgilib/bedCart.c src/hg/cgilib/bedCart.c index 0a226e5b21c..591677692c7 100644 --- src/hg/cgilib/bedCart.c +++ src/hg/cgilib/bedCart.c @@ -1,38 +1,46 @@ /* bedCart.c - take care of parsing values from the * bed trackDb optional settings and the same values that may be * in the cart. */ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "common.h" #include "jksql.h" #include "trackDb.h" #include "cart.h" #include "dystring.h" #include "bedCart.h" #include "hgConfig.h" #if defined(NOT_YET) extern struct cart *cart; /* defined in hgTracks.c or hgTrackUi */ /* This option isn't in the cart yet ... maybe later */ #endif /****** itemRgb - on by default **************************/ boolean bedItemRgb(struct trackDb *tdb) { if (tdb == NULL) return TRUE; -if ((trackDbSettingClosestToHome(tdb, "color") != NULL) || trackDbSettingOff(tdb, OPT_ITEM_RGB)) +/* An explicit setting in the stanza wins, either way. The "color" test below is only + * about whether to turn itemRgb on by DEFAULT, so it must not be reached first: a stanza + * that says both "itemRgb on" and "color" wants its items from the file's own RGB column + * and its labels from color, which is what it got before 88d620e6c82 folded the two + * tests into one early return. */ +if (trackDbSettingOff(tdb, OPT_ITEM_RGB)) return FALSE; if (trackDbSettingOn(tdb, OPT_ITEM_RGB)) return TRUE; +if (trackDbSettingClosestToHome(tdb, "color") != NULL) + return FALSE; + if ((cfgOptionBooleanDefault("alwaysItemRgb", TRUE) == FALSE)) return FALSE; return TRUE; }