+ }
+ if (output_format == O_DZEN2)
+ (void)snprintf(colorbuf, sizeof(colorbuf), "^fg(%s)", cfg_getstr(cfg_general, colorstr));
+ else if (output_format == O_XMOBAR)
+ (void)snprintf(colorbuf, sizeof(colorbuf), "<fc=%s>", cfg_getstr(cfg_general, colorstr));
+ else if (output_format == O_LEMONBAR)
+ (void)snprintf(colorbuf, sizeof(colorbuf), "%%{F%s}", cfg_getstr(cfg_general, colorstr));
+ else if (output_format == O_TERM) {
+ /* The escape-sequence for color is <CSI><col>;1m (bright/bold
+ * output), where col is a 3-bit rgb-value with b in the
+ * least-significant bit. We round the given color to the
+ * nearist 3-bit-depth color and output the escape-sequence */
+ char *str = cfg_getstr(cfg_general, colorstr);
+ int col = strtol(str + 1, NULL, 16);
+ int r = (col & (0xFF << 0)) / 0x80;
+ int g = (col & (0xFF << 8)) / 0x8000;
+ int b = (col & (0xFF << 16)) / 0x800000;
+ col = (r << 2) | (g << 1) | b;
+ (void)snprintf(colorbuf, sizeof(colorbuf), "\033[3%d;1m", col);
+ }
+ return colorbuf;