def color_to_rgba(color):
    """Converts a color (tuple or string) to an RGBA tuple.
    
    This function does not validate the input, so if the input format
    does not match one of the formats listed below, the output format
    is not guaranteed.

     Args:
         color: The color to be converted. It can be:
             An RGB tuple. 3 ints/floats between 0.0 and 1.0.
                e.g. (1, 0, 0)
             An RGBA tuple. 4 ints/floats between 0.0 and 1.0 (in which 
                case it is returned as is).
                e.g. (1, 0, 0, 0.5)
             An RGB hex string.
                e.g. #ff0000, ff0000, #f00, f00 (these are all 
                equivalent)
             An RGBA hex string.
                e.g. #ff0000cc, #f00c, ff0000cc, f00c (these are all 
                equivalent)
    Returns:
        A RGBA tuple of 4 ints/floats between the values 0.0 and 1.0.
    """
    if isinstance(color, tuple):
        if len(color) == 4:
            return color
        if len(color) == 3:
            return (*color, 1)

    if isinstance(color, str):
        _color = color.lstrip('#')
        if len(_color) == 3:
            _color = _color[0] * 2 + _color[1] * 2 + _color[2] * 2 + 'ff'
        elif len(_color) == 4:
            _color = _color[0] * 2 + _color[1] * 2 + _color[2] * 2 + _color[3] * 2
        elif len(_color) == 6:
            _color += 'ff'
        if len(_color) == 8:
            return tuple(int(_color[i : i + 2], 16) / 255 for i in range(0, 8, 2))

    raise ValueError(f'Invalid color: {color}')