To change the color scheme, edit the [Colors] section in config.txt
. However, you cannot do this during a program- and even if you could it would be disgustingly inefficient. You need not install any new modules. You can do this through subprocess
, a module that comes with Python.
Something like:
from subprocess import call
call('color a', shell=True) #this sets the color to light green
print('The quick brown fox jumps over the lazy dog.')
This works for Windows, and you can easily change the command that is called depending on the operating system. For your program, you could put the colours in a for
loop, changing with the messages in the print
statement.
As a note, this only works if you run it from its file location or from the command line. It will not work when you run it in IDLE. Hope I helped!
EDIT: You can find a list of colours here. The syntax is: color 'background ID''text ID'
.
This would allow you to do something like:
import time
from subprocess import call
for color in('a', 'e', 'c'): #cycles through different colours
call('cls', shell=True) #clears the screen
call('color ' + color, shell=True)
print('The quick brown fox jumps over the lazy dog.')
time.sleep(1)
input("\nPress enter to exit. ")
From that, you can modify the code to use colours of your choice. Unfortunately, there is absolutely no way no have all the colors on the screen at the same time. For that you DO need external modules, I'm afraid.