pygame时报错TypeError: invalid color argument

用pygame写长方形彩虹的时候,使用了如下代码:

import pygame
pygame.init()

height=300
width=400
windowSize=[400,300]
screen=pygame.display.set_mode(windowSize)
colour=pygame.color.Color('#FE12AD')

row=0
done=False
while not done:#while not ..的意思就是当done是False的时候执行下列语句,while done就是当done是True的时候执行下列语句
    increment=255/100
    while row<=height:
        pygame.draw.rect(screen,colour,[0,row,width,row + increment])
        pygame.display.flip()
        if colour[2] + increment<255 :
            colour[2] += increment
        row+=increment

#想要关闭窗口        
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done=True

pygame.quit()

但出现了报错:

    colour[2] += increment
TypeError: invalid color argument

请问大佬们应该怎么解决呢

颜色必须是0-255之间的整数,这句代码的 increment 不是整数: `colour[2] += increment`

取整下即可:`increment=round(255/100)`