Setting the color gradients of the element(BAR)

LVGL version 8.3

using the code from the example:

lv_style_set_bg_opa(&style_indic, LV_OPA_COVER);
lv_style_set_bg_color(&style_indic, lv_palette_main(LV_PALETTE_RED));
lv_style_set_bg_grad_color(&style_indic, lv_palette_main(LV_PALETTE_GREEN));
lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_VER);

lv_obj_t * bar = lv_bar_create(lv_scr_act());
lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
lv_obj_set_size(bar, 20, 200);

At the same time, the color of the bar smoothly changes from GREEN to RED.
A YELLOW color is required in the middle of the indicator.
How do I set up a color change with summation, what color settings should I apply?