Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Color not assuming #70

Open
FilipeOS opened this issue Jul 20, 2018 · 1 comment
Open

Custom Color not assuming #70

FilipeOS opened this issue Jul 20, 2018 · 1 comment

Comments

@FilipeOS
Copy link

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?

@pasdam
Copy link

pasdam commented Sep 6, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants