No, you cannot alter a cell's color using a Function(). You can, however, alter it in a Sub() routine.
Simply write a Sub() that will run your function on the cells you wish it to be run on, then after each is run, put an If-statement to see if you want to color it based on the value it returns.