Perhaps I wasn't that clear, and i see you wanted to change the DurationBar not the whole background color
So here code example
protected void DayPilotCalendar1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
{
switch (e.Tag)
{
case 0:
e.DurationBarColor = "yellow";
break;
case 1:
e.DurationBarColor = "red";
break;
case 2:
e.DurationBarColor = "green";
break;
}
}