How to change a player's tablist name color

For such a simple task I found only one article online (here). It suggested you could change the tablist name color like this:

player.offer(Keys.DISPLAY_NAME, Text.of(TextColors.RED, player.getName());

Perhaps I did something wrong but changing this on player login did not modify the tablist text at all. So I found another way that worked perfectly.

Player player = (player whose name color we want to change);
for(Player players : Sponge.getServer().getOnlinePlayers())
    players.getTabList().getEntry(player.getUniqueId()).get().setDisplayName(Text.of(TextColors.RED, player.getName());

Just put this in a Listener for player login, and run it for each player that logs in. You can add your own logic to determine what players get what name colors. Hope this helps someone!