I want to use this overly command
inside an equation environment to color some terms.
How can I do this?
You really should provide a more complete example. I'm guessing that you may be after something like the example below, but if my guess is wrong I'll delete this answer.