I actually wrote a Windows app to do something like this. It's sitting in my unfinished folder because I ran into too many issues to fix for a hobby project. The rectangle data for Windows apps seems to vary widely. I needed a bunch of different formulas to correct for the rectangles I was getting back from the WinAPI calls.
One of my features was a different border color for each app. I tried various color rules, such as multiple copies of VSCode would each get their own shade of blue, or cycle through colors of the rainbow.