Last active
September 4, 2018 07:11
-
-
Save colinrtwhite/50feeacf2fb5bd97b5fa4a4562581c83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@CheckResult fun Drawable.tint(@ColorInt color: Int): Drawable { | |
val tintedDrawable = DrawableCompat.wrap(this).mutate() | |
DrawableCompat.setTint(tintedDrawable, color) | |
return tintedDrawable | |
} | |
@CheckResult fun Drawable.tint(context: Context, @ColorRes color: Int): Drawable { | |
return tint(context.getColorCompat(color)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment