@@ -68,7 +68,7 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
6868 if (!borderAsValue && options -> barBorderLeft .length )
6969 {
7070 if (!options -> pipe )
71- ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_WHITE "m" );
71+ ffStrbufAppendF (buffer , "\e[%sm" , options -> barColorBorder . chars );
7272 ffStrbufAppend (buffer , & options -> barBorderLeft );
7373 }
7474
@@ -78,11 +78,13 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
7878 ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_BLACK "m" );
7979
8080 for (uint32_t i = 0 ; i < options -> barWidth ; ++ i )
81+ {
8182 ffStrbufAppend (buffer , borderAsValue && i == 0
8283 ? & options -> barBorderLeft
8384 : borderAsValue && i == options -> barWidth - 1
8485 ? & options -> barBorderRight
8586 : & options -> barCharTotal );
87+ }
8688 }
8789 else
8890 {
@@ -91,7 +93,7 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
9193 const char * colorRed = options -> percentColorRed .chars ;
9294
9395 FFPercentageTypeFlags percentType = config .type == 0 ? options -> percentType : config .type ;
94- bool monochrome = !!(percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT );
96+ bool monochrome = !!(percentType & FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT ) || options -> barColorElapsed . length ;
9597
9698 for (uint32_t i = 0 ; i < blocksPercent ; ++ i )
9799 {
@@ -100,7 +102,9 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
100102 if (monochrome )
101103 {
102104 const char * color = NULL ;
103- if (green <= yellow )
105+ if (options -> barColorElapsed .length )
106+ color = options -> barColorElapsed .chars ;
107+ else if (green <= yellow )
104108 {
105109 if (percent < green ) color = colorGreen ;
106110 else if (percent < yellow ) color = colorYellow ;
@@ -136,20 +140,22 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
136140 if (blocksPercent < options -> barWidth )
137141 {
138142 if (!options -> pipe )
139- ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_WHITE "m" );
143+ ffStrbufAppendF (buffer , "\e[%sm" , options -> barColorTotal . chars );
140144 for (uint32_t i = blocksPercent ; i < options -> barWidth ; ++ i )
145+ {
141146 ffStrbufAppend (buffer , borderAsValue && i == 0
142147 ? & options -> barBorderLeft
143148 : borderAsValue && i == options -> barWidth - 1
144149 ? & options -> barBorderRight
145150 : & options -> barCharTotal );
151+ }
146152 }
147153 }
148154
149155 if (!borderAsValue && options -> barBorderRight .length )
150156 {
151157 if (!options -> pipe )
152- ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_WHITE "m" );
158+ ffStrbufAppendF (buffer , "\e[%sm" , options -> barColorBorder . chars );
153159 ffStrbufAppend (buffer , & options -> barBorderRight );
154160 }
155161
0 commit comments