I'm trying to change the color of my program by pressing some specific keys. Below is some pieces of my code. I tried the following but it doesn't seem to work.
color = (0,0,255)
chars = []
for char in characters:
item = font.render(char, True, (color))
chars.append(item)
gray = (127, 127, 127)
white = (255, 255, 255)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
quit()
if event.key == pygame.K_g:
color = gray
if event.key == pygame.K_w:
color = white