amulyakhare/TextDrawable

Custom Color not assuming

Opened this issue · 1 comments

Hi there,

I have tried to place a custom color coming from color.xml but it's not assuming, it's showing a random color, not the one I try to use, even on MATERIAL or DEFAULT

`String firstLetter = String.valueOf(calls.getName().charAt(0));

    ColorGenerator generator = ColorGenerator.MATERIAL;
    int color = generator.getColor(R.color.amber_400);

    TextDrawable drawable = TextDrawable.builder()
            .beginConfig()
            .fontSize(50)
            .bold()
            .toUpperCase()
            .endConfig()
            .buildRound(firstLetter, color);`

Can someone help?

In an Activity or a Fragment you can do this:

int color = getResources().getColor(R.color.amber_400);

TextDrawable drawable = TextDrawable.builder()
            .beginConfig()
            .fontSize(50)
            .bold()
            .toUpperCase()
            .endConfig()
            .buildRound(firstLetter, color);

Source.