As said above. Blue is when the unit is 5+ levels above its base, Orange for 10+ levels and Red for 15+ levels.
It counts the levels that unit has gained after it can't evolve anymore on the given map. So a level 17 Berzerker will have a red sword, but a level 17 Overlord will have an orange one, because Overlord's base level is 5, so will only get a red sword at level 20. I think this is what StormLord meant by the "inconsistency", but it's not.
Basically, it serves as a quick info on how powerful a unit is. If you see a lot of red swords, you can expect very strong units.
Post edited April 04, 2023 by idbeholdME