Skip to main content

Tint — wiki

How to 'tint' a pygame surface. Maybe you want to make a surface a bit more red?

def tint(surf, tint_color):
    """ adds tint_color onto surf.
    """
    surf = surf.copy()
    surf.fill((0, 0, 0, 255), None, pygame.BLEND_RGBA_MULT)
    surf.fill(tint_color[0:3] + (0,), None, pygame.BLEND_RGBA_ADD)
    return surf

tint(surf, (30, 0, 0))
This is part of the CookBook.