Skip to content

Instantly share code, notes, and snippets.

View VivekBhalodiya's full-sized avatar

Vivek Bhalodiya VivekBhalodiya

View GitHub Profile
fun changeDrawableColor(
context: Context,
icon: Int,
newColor: Int
): Drawable? {
val mDrawable: Drawable? = ContextCompat.getDrawable(context, icon)
mDrawable?.let {
DrawableCompat.setTint(
DrawableCompat.wrap(it),
ContextCompat.getColor(context, newColor)