/* Prepare a color buffer for a single LED using its color mapping and the desired color index.  */
static int prepare_color_buffer(const struct led_info *info, uint8_t *buf, uint8_t color_idx)
/* Prepare a color buffer for a single LED using its color mapping and the desired color index.  */
static int prepare_color_buffer(const struct led_info *info, uint8_t *buf, uint8_t color_idx)
{
	uint8_t color;
	for (color = 0; color < info->num_colors; color++) {
		switch (info->color_mapping[color]) {
		case LED_COLOR_ID_RED:
			buf[color] = colors[color_idx][0];
			continue;
		case LED_COLOR_ID_GREEN:
			buf[color] = colors[color_idx][1];
			continue;
		case LED_COLOR_ID_BLUE:
			buf[color] = colors[color_idx][2];
			continue;
		default:
			LOG_ERR("Invalid color: %d",
				info->color_mapping[color]);
			return -EINVAL;
		}
	}
	return 0;
}