aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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))