mabe02 / lanterna

Java library for creating text-based GUIs
GNU Lesser General Public License v3.0
2.23k stars 243 forks source link

ProgressBar not updating visual progress #545

Closed botboy0 closed 2 years ago

botboy0 commented 3 years ago

Hello, I am currently trying to make a progressbar but whenever I set its value it doesnt update its visual progress apart from changing the text shown on screen image image

Chris-GW commented 2 years ago

The problem lies in your used SimpleTheme at line 92, which does not specify any colors for the ProgressBar. This causes the filled part and missing part to both be drawn in black on a black background. You should set the theme definition for ProgressBar or use some build in themes.

TextColor.ANSI foregroundColor = TextColor.ANSI.WHITE_BRIGHT;
SimpleTheme theme = new SimpleTheme(foregroundColor, TextColor.ANSI.BLACK);
Definition progressBarDefinition = theme.addOverride(ProgressBar.class,
        foregroundColor, ANSI.BLUE); // blue for missing part
progressBarDefinition.setActive(foregroundColor, TextColor.ANSI.GREEN); // green for filled part
window.setTheme(theme);

// or use some other registered dark themes
window.setTheme(LanternaThemes.getRegisteredTheme("blaster"));
mabe02 commented 2 years ago

Thanks @Chris-GW, I'll close this. @botboy0 please re-open if needed.