I want to fill PNG icons with colors.
Here is my current code:
ingredientImageView.setImageResource(context.getResources().getIdentifier("ico_" + ingredient.replace("-", "_"), "drawable", context.getPackageName()));
ingredientImageView.setColorFilter(iconTextColor,PorterDuff.Mode.SRC_IN);
This code makes my icons like this:
iconTextColor here is black. But color filter fills the white parts of the icon. You can find the icon below:
Black lines should become the color that I want. But inside of the leaves(in that icon) should remain white.
So, transparent -> transparent, white->white, black->dynamicColor
How can I do that?
You can try to define a custom ColorMatrix with random r g b values: