verigak / progress

Easy to use progress bars for Python
ISC License
1.41k stars 179 forks source link

Changing color of progress bar. #102

Closed VahedCivil closed 2 years ago

VahedCivil commented 2 years ago

Hi How I can change the text color of progress bar? I have a solution but I wanna do it directly with progress module

` import time from colorama import Fore, Back, Style

from progress.bar import Bar from progress.bar import ChargingBar from progress.bar import FillingSquaresBar from progress.bar import FillingCirclesBar from progress.bar import IncrementalBar from progress.bar import PixelBar from progress.bar import ShadyBar

from progress.spinner import Spinner from progress.spinner import PieSpinner from progress.spinner import MoonSpinner from progress.spinner import LineSpinner from progress.spinner import PixelSpinner

bars = (ChargingBar, FillingSquaresBar, FillingCirclesBar, IncrementalBar, PixelBar, ShadyBar) print('🔔 Bars: ') for func in bars: print(Fore.GREEN + f'\n{str(func)} 👇') n = 15 bar = func('Processing', max=n) for i in range(n):

Do some work

    time.sleep(0.1)
    print(Fore.RED + "\033[F")
    bar.next()
bar.finish()

print(Style.RESET_ALL)

spinners = (Spinner, PieSpinner, MoonSpinner, LineSpinner, PixelSpinner) print('\n🔔 spinners: ') for func in spinners: print(Fore.GREEN + f'\n{str(func)} 👇') n = 10 spinner = func('Loading ') for i in range(n):

Do some work

    time.sleep(0.1)
    print(Fore.RED + "\033[F")
    spinner.next()
spinner.finish()

print(Style.RESET_ALL)

`

verigak commented 2 years ago

Try e.g.: bar = func('Processing', max=n, color='red')