I was wondering where the color came from, it just arbitrarily chooses one of the badge colors? Yeah, that doesn't work.
There are ONLY A FEW COLORS to even display. Your units, enemy units, screeps units, roads, structures, etc. Don't be lazy with the UI! Store them as 32 bit color values the user can set.
Then, everyone is happy! Even that one guy with teal-chartreuse colorblindness can set the UI to something they can see.