<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_color(self, arr, state):
 """Apply color formula to an array."""

        ops = self.cmd(state)
        for func in parse_operations(ops):
            arr = func(arr)
        return arr