amulyakhare / TextDrawable

This light-weight library provides images with letter/text like the Gmail app. It extends the Drawable class thus can be used with existing/custom/network ImageView classes. Also included is a fluent interface for creating drawables and a customizable ColorGenerator.
MIT License
3.16k stars 622 forks source link

Custom colors #7

Closed saket closed 9 years ago

saket commented 9 years ago

Hi, thanks so much for the library. I have a small request, related to the random colors. The current implementation uses a fixed set of colors. Could you please add an option so that we can use our own?

Thank you. :)

saket commented 9 years ago

I just realized how stupid I am. Custom colors are totally possible. Sorry :/

pasdam commented 6 years ago

Since you already figured it out, this comment is just for future reference. In an Activity or a Fragment you can do this:

int color = getResources().getColor(R.color.my_custom_color);
TextDrawable drawable = TextDrawable.builder().buildRound(firstLetter, color);

Source.