Background Color

I ahve a field (function) in which the following code is set:
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
styled("Gewinn", "green", "", "")
else
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' >= 'aktueller Kurs' * Anzahl then
styled(text("Verlust"), "#ffa500", "black", "")
end
end
Whatever I do,
the result is never what I wanted:
I want:
If positive, then
a) Background Color green
b) Text in white
c) Symbol arrow-n
if not
a) Background Color red
b) Text in white
c) Symbol arrow-S

What puzzles me is the fact that the code is well working with other fields, but not in this case...

Here you go
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
styled("Gewinn", "green", "white", "arrow-n")
else
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' >= 'aktueller Kurs' * Anzahl then
styled(text("Verlust"), "red", "white", "arrow-s")
end
end

Thank you, but this does not help. What I get is a white field with a white text and an icon.
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
styled("Gewinn", "green", "white", "arrow-n")
else
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' >= 'aktueller Kurs' * Anzahl then
styled(text("Verlust"), "red", "white", "arrow-s")
end
end
What could be the problem?
Thank you

Or simplified:
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
styled(text("Gewinn"), "green", "", "arrow-n")
else
styled(text("Verlust"), "red", "red", "arrow-s")
end
I wonder why in this constellation I cannot change the background color of the cell. It is just not shown.

Maybe because the formula field is styled in the settings of that field...(where you can chose also the style of the border etc.)

It works for me...
https://1drv.ms/u/s!AglD8AFJ3Q28gskiXIanKDp_lzkrew?e=CUq3Jm

Thank you, Nick. The problem was that the setting of the field itself overrule. as Steven indicated. Although I just centered the cell, it seems that even this results in overruling color settings. Thank you, problem solved.