Source code for iaa_od.palette.to_rgba

[docs] def to_rgba(color: tuple[int, int, int], /, *, alpha: float = 1.0) -> tuple[float, float, float, float]: """ Converts an RGB color tuple to an RGBA color tuple with the specified alpha value (1.0 by default). Parameters: color (tuple[int, int, int]): A tuple representing the RGB color (R, G, B) with values in the range 0-255. alpha (float): The alpha value for the RGBA color, ranging from 0.0 (fully transparent) to 1.0 (fully opaque). Returns: tuple[float, float, float, float]: A tuple representing the RGBA color (R, G, B, A) with values in the range 0.0-1.0. """ r, g, b = color return (r / 255, g / 255, b / 255, alpha)