def valid_supported_color_modes(color_modes: Iterable[str]) -> set[str]: """Validate the given color modes.""" color_modes = set(color_modes) if (not color_modes or COLOR_MODE_UNKNOWN in color_modes or (COLOR_MODE_BRIGHTNESS in color_modes and len(color_modes) > 1) or (COLOR_MODE_ONOFF in color_modes and len(color_modes) > 1)): raise vol.Error(f"Invalid supported_color_modes {sorted(color_modes)}") return color_modes
def valid_supported_color_modes( color_modes: Iterable[ColorMode | str], ) -> set[ColorMode | str]: """Validate the given color modes.""" color_modes = set(color_modes) if (not color_modes or ColorMode.UNKNOWN in color_modes or (ColorMode.BRIGHTNESS in color_modes and len(color_modes) > 1) or (ColorMode.ONOFF in color_modes and len(color_modes) > 1) or (ColorMode.WHITE in color_modes and not color_supported(color_modes))): raise vol.Error(f"Invalid supported_color_modes {sorted(color_modes)}") return color_modes