def _to_rgba(color):
    """
    Converts a color to RGBA.

    Parameters
    ----------
    color : int, float or list
        If numeric, is interpreted as gray-value between 0 and 1. If list, has to have length 3 or 4 and is interpreted
        as RGB / RGBA depending on length (again, with values in [0, 1]).

    Returns
    -------
    list

    """
    if isinstance(color, (int, float)):  # color given as brightness
        result = [color, color, color, 1]
    elif isinstance(color, list):
        if len(color) == 3:  # color given as RGB
            result = color + [1]
        elif len(color) == 4:
            result = color.copy()
        else:
            assert False, f'len({color}) = {len(color)} has to be in [3, 4]'
    else:
        assert False, f'color specification not understood: {color}'
    return result