aboutsummaryrefslogtreecommitdiff
path: root/library/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-15 20:33:33 -0700
committerAllan Wang <me@allanwang.ca>2017-06-15 20:33:33 -0700
commitbce8928d7ac2813a385db219fa7f40c98acac097 (patch)
tree596028cd46045ae00165b8145cb6e02b7dcdd973 /library/src/main
parent15e77962960b043c657bd8ee1b719dbd41e636fb (diff)
downloadkau-bce8928d7ac2813a385db219fa7f40c98acac097.tar.gz
kau-bce8928d7ac2813a385db219fa7f40c98acac097.tar.bz2
kau-bce8928d7ac2813a385db219fa7f40c98acac097.zip
Add is color transparent
Diffstat (limited to 'library/src/main')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
index e7a3e21..eb285ef 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
@@ -56,6 +56,9 @@ fun Int.adjustAlpha(factor: Float): Int {
return Color.argb(alpha, Color.red(this), Color.green(this), Color.blue(this))
}
+val Int.isColorTransparent: Boolean
+ get() = Color.alpha(this) != 255
+
@ColorInt
fun Int.withAlpha(@IntRange(from = 0L, to = 255L) alpha: Int): Int
= Color.argb(alpha, Color.red(this), Color.green(this), Color.blue(this))