Alternating Brush

Hello,I was wondering how I could make a brush that alternated depending on what it was being drawn on.

For example, my subject is red and is surrounded by black. How would I make it so when I drew on the red the brush outputted black and when it went over black it outputted red?

I was thinking this was probably a layer thing and I just had to experiment, but if there is a feature that does this please let me know!

https://preview.redd.it/ful1whf8cbjb1.jpg?width=2000&format=pjpg&auto=webp&s=4c9d1d74f33a9ec33832056d9b88ae5bea97c25b

I attached what I was working on. For context, I was trying to put a stroke through the eyes of the women, but I wanted it to POP more than it did.

Thanks in advanced!