I have looked into the issues in your question, and found that, unfortunately,
1. testing for color can't be done with a formula - you would need VB script code for that.
which explain that the VB property ColorIndex
can be tested by VB code, or can be set by VB code.)
To do this task by VB code instead of with a formula, you create a VBA macro, save it in the workbook, and then you build a formula that uses that macro.
2. changing the color in a cell in reaction to some condition as determined by a formula can be done only by 'Conditional formatting', apparently - which is not the easy 'fill with the same formula' process you are looking for, as it apparently needs to be done one-cell-by-one-cell (though I am not certain of this, not certain that it is limited to one cell at a time).
In short, to get the action you require, you need either VB scripting and/or Conditional Formatting.
There is a formula that is *near* what you need, in
but that tests for background color in the cell, I think.
Since this isn't an Answer, I have posted this as an Inquiry, though I haven't asked anything.
Since someone else might have the advanced comprehension needed for the task, I have Opted Out of this case.