def METHOD_NAME(color):
    """
    Convert hex color #xxx or #xxxxxx to [r, g, b].
    """
    if not HEX_RE.match(color):
        color = "#FFF"
    if len(color) == 7:
        return (int(color[1:3], 16), int(color[3:5], 16), int(color[5:], 16))
    return (
        int(color[1], 16) * 17,
        int(color[2], 16) * 17,
        int(color[3], 16) * 17,
    )