From bce8928d7ac2813a385db219fa7f40c98acac097 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 15 Jun 2017 20:33:33 -0700 Subject: Add is color transparent --- library/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'library') 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)) -- cgit v1.2.3