Debian Codegraph @

demos/demo03.py

raw ◀ ▶
1 Debian patch touch this file
•1 #!/usr/bin/python3
2 # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
3
4 # Demonstrate the different behavior when autoreset is True and False.
5
6 from __future__ import print_function
7 import fixpath
8 from colorama import init, Fore, Back, Style
9
10 init(autoreset=True)
11 print(Fore.CYAN + Back.MAGENTA + Style.BRIGHT + 'Line 1: colored, with autoreset=True')
12 print('Line 2: When auto reset is True, the color settings need to be set with every print.')
13
14 init(autoreset=False)
15 print(Fore.YELLOW + Back.BLUE + Style.BRIGHT + 'Line 3: colored, with autoreset=False')
16 print('Line 4: When autoreset=False, the prior color settings linger (this is the default behavior).')