With reference to the attached sample file, when I input the numbers in above rows it is appearing in a blue colour while in the row of the total number is in black colour.
The colors in your workbook have been manually set using the Font Color Selector
You cannot set colors using formula, except that you can use Conditional Formatting or Styles to set colors
Styles apply colors according to Header, Body and Total Rows
Styles are useful when applied to Data tables
Conditional Formatting can set color according to a formula
in your case if Column A contains "Total Food at home" set color to Black else make it blue