Blame bundled/colorama/demos/demo03.py

Packit Service 3a3820
#!/usr/bin/python
Packit Service 3a3820
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
Packit Service 3a3820
Packit Service 3a3820
# Demonstrate the different behavior when autoreset is True and False.
Packit Service 3a3820
Packit Service 3a3820
from __future__ import print_function
Packit Service 3a3820
import fixpath
Packit Service 3a3820
from colorama import init, Fore, Back, Style
Packit Service 3a3820
Packit Service 3a3820
init(autoreset=True)
Packit Service 3a3820
print(Fore.CYAN + Back.MAGENTA + Style.BRIGHT + 'Line 1: colored, with autoreset=True')
Packit Service 3a3820
print('Line 2: When auto reset is True, the color settings need to be set with every print.')
Packit Service 3a3820
Packit Service 3a3820
init(autoreset=False)
Packit Service 3a3820
print(Fore.YELLOW + Back.BLUE + Style.BRIGHT + 'Line 3: colored, with autoreset=False')
Packit Service 3a3820
print('Line 4: When autoreset=False, the prior color settings linger (this is the default behavior).')