This Flarum extension changes the username colour on posts to the user's first rank. If they have no rank, the default colour will be used.
This only changes the colour on posts for now. This may be updated in the future to set the colour in all places.
This is a simple edit of clarkwinkelmann's Color Circles for Groups
To install the latest version compatible with your forum:
composer require mickmelon/flarum-ext-coloured-usernames