diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-15 20:33:33 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-15 20:33:33 -0700 |
commit | bce8928d7ac2813a385db219fa7f40c98acac097 (patch) | |
tree | 596028cd46045ae00165b8145cb6e02b7dcdd973 /library/src/main | |
parent | 15e77962960b043c657bd8ee1b719dbd41e636fb (diff) | |
download | kau-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.kt | 3 |
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)) |