Problem with if statement for displaying day of the week with specific color

Why this if statement doesn't work?

$if(df(e)=7,[c=#FF0000]df(EEEE)[/c],$df(EEEE)$

It just returns 0.

BB code should be placed outside a formula to avoid issues, so, what you want to do is

[c=$if(df(e) = 7, #FF0000)]$df(EEEE)$[/c]

The only problem i see with this is that you should also provide a default color if the condition is false