Skip to content

Commit be52795

Browse files
Carson JonesCarson Jones
authored andcommitted
fix volume bar border colors when using make_marketcolors
When make_marketcolors() is called with custom volume colors, it updates marketcolors['volume'] but leaves marketcolors['vcedge'] pointing to the old base style value. This causes the equality check in plotting.py (mc['volume'] == mc['vcedge']) to fail, so the auto-darkening logic for volume bar edges is skipped and the old base style colors are used instead. Fix by syncing vcedge with volume whenever volume colors are changed in make_marketcolors(). Fixes #676
1 parent 493811d commit be52795

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/mplfinance/_styles.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ def _check_and_set_mktcolor(candle,**kwarg):
346346
c = _check_and_set_mktcolor(candle,**kwa)
347347
marketcolors.update([(kw,c)])
348348

349+
# Keep vcedge in sync with volume so that the auto-darkening
350+
# logic in plotting.py still triggers after custom volume colors
351+
# are applied (fixes issue #676).
352+
if config['volume'] is not None or config['inherit'] == True:
353+
marketcolors['vcedge'] = marketcolors['volume']
354+
349355
if config['hollow'] is not None:
350356
marketcolors.update({'hollow':config['hollow']})
351357

0 commit comments

Comments
 (0)