So I've been reading up on how the auto-generated background color for contacts is created. Apparently it's based on a hashCode() of a key in the contact. I've seen it said that the email is used as the key, but that makes no sense, since not all my contacts have emails associated with them, and the ones that don't aren't all the same color.
Ultimately, I want to be able to get the EXACT color used in the contact's card. That way the icon I have in my app has the same background color as will be used when you click on it and open the contact card using the ACTION_VIEW.
So, just wondering what I need to use as a key to generate the same color that is generated by the android contacts app, for each individual contact? Thanks.
PS. Here's the hex codes that I have right now for the color palate. If someone could chime in on the accuracy of this as well, I would really appreciate it. Thanks.
<array name="letter_tile_colors">
<item>#f16364</item>
<item>#f58559</item>
<item>#f9a43e</item>
<item>#e4c62e</item>
<item>#67bf74</item>
<item>#59a2be</item>
<item>#2093cd</item>
<item>#ad62a7</item>
</array>
Edit: Some folks have been saying it's similar to another answer, Android lollipop contact color
The problem with that answer is it's incomplete. It explains how to generate colors in the same way, but I'm not just trying to do random color generation. I'm looking to get the EXACT color that the default contacts app uses for that contact.