def blend_color(a, b, r):
    """blends color a and b in r ratio."""
    return (
        int(a[0] + (b[0] - a[0]) * r[0]),
        int(a[1] + (b[1] - a[1]) * r[1]),
        int(a[2] + (b[2] - a[2]) * r[2])
    )