Change row color and background color

I have a data grid that contains an RGB for both color and background color. I am able to change the background color based on the row column, but I can get the text color to change in the same way. It always ignores the text color.
these are the ways I have tried. It works in the calendar fine, but not in the datagrid.

I can't see what I am missing...

It will be better to use CSS classes instead inline styles for better control:

Yes, I have duplicated that for other parts of my application, in this case, the colors represent staff members that can change constantly. When a new staff member is add, they are assigned a color, which I then need to access and change the color of the row. I can do this no problem, but when the color is dark, I need to assign a light color to the text. I can accomplish this fine in a calendar, but does not work the same way in the grid. So far I can change the background-color, but not the text (fore color).

args.Attributes.Add("style", $"background-color: {args.Data.Schedule_Color};"+$" color: {args.Data.Schedule_ForeColor};");

works perfectly in a calendar, but when I apply the same format to a grid cellrender, it only changes the background-color, not the text color.

If I create a css class, I would have to add a new class everytime I added staff.

${event}.Attributes.Add("style", $"background-color: {${event}.Data.Summary_Color};");

this works to change the background color, but when I add color it ignores the text color

${event}.Attributes.Add("style", $"background-color: {${event}.Data.Summary_Color};"+$" color: {${event}.Data.Summary_ForeColor};");
does not work

${event}.Attributes.Add("style", $"background-color: {${event}.Data.Summary_Color}; color: {${event}.Data.Summary_ForeColor};");
does not work

even just trying to change the text color

${event}.Attributes.Add("style", $"background-color: {${event}.Data.Summary_Color}; color: {${event}.Data.Summary_ForeColor};");
does not work.

I need help with the right combination to get this formula to work.

Check the generated code and also inspect the table cell with your developer tools to see what color is applied.

Thank you for the help. I got it to work thanks to the many examples you have created. I set the background color using

${event}.Attributes.Add("style", $"background-color: {${event}.Data.Summary_Color};");

the I used the last example you gave me to set the text color the either white or black, depending on a value I set in the staff table (either white or black)

I created the two classes as in your example and then created the code to set color based on class 1 or class 2

${event}.Attributes.Add("class", $"{(args.Data.Summary_ForeColor.Contains("white") ? "myClass1" : "myClass2")}");
I does exactly what I needed to do, so thanks again!