Set color and background of TWebListControl Item individually.

I need to set the background and font color of the Items in a TWebListControl dynamically. I have the common style attributes set for all items except the 2 colors that the customer can change. How can I set these properties individually, dynamically?

I tried for some time with Item.ListElement until I realized it did not exist.

console.log(Item.ListElement) returns null

You can change the color of items via CSS via the event OnGetItemClass.

For example, CSS added in project.html:

    .reditem {background-color:red; color: yellow;}

and this Pascal event handler:

procedure TForm1.WebListControl1GetItemClass(Sender: TObject; AItem: TListItem;
  var AClassName: string);
  if odd(AItem.Index) then
    AClassName := 'reditem';

creates a TWebListControl with banding.

I do that for all the other attributes, and also as a test did the ODD/EVEN , but I don't know the colors in advance to create the style. The customer adds a service type and gives them a font color and background color, they even change them at times so I can't use css.

You can dynamically generate CSS.
TForm has method form.AddCSS(id, css);