Choose distinct colors based on Custom Properties
You can do it with the latest Blender Version (2.92+) and custom properties :

Download the latest version (At least 2.92+, which is currently in Beta but should be officially released pretty soon).
Select your object, and create your custom property, named &quot;country&quot;.
In the value field, you can input a string of characters. Don't forget to press OK to validate your change.



Create another property, let's call it hash. Keep the min and max between 0 and 1.



Right click in the field and choose Add Driver. Delete the target variable, check Self and type hash(self[&quot;country&quot;])%1000/1000. This will generate a (kinda) random number between 0 and 1 depending on the string inside the country property. The hash provides the same output if 2 inputs are the same.



Important : You have to enable python scripts globally for this to work. Go to Edit &gt; Preferences &gt; Save &amp; Load and enable Auto run python scripts. You can add your Downloads folder for security, that way downloaded files won't execute custom scripts automatically.



Add a material to your object. Use this layout :


Add an Attribute node set to Object type, and input the hash custom property name. Link it to a Combine HSV node to create a random hue.

Result :