From beeabe17c4fbe9d915b26b8a936c6248858dce64 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 20 Apr 2020 01:48:31 -0400 Subject: [PATCH] Checking alpha component when check if a color is dark Because turns out some scanalors leave an uncropped alpha in their pages --- app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt index 7f6161cb8f..ffb3fde9d2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt @@ -206,7 +206,8 @@ object ImageUtil { fun Boolean.toInt() = if (this) 1 else 0 private fun isDark(color: Int): Boolean { - return Color.red(color) < 40 && Color.blue(color) < 40 && Color.green(color) < 40 + return Color.red(color) < 40 && Color.blue(color) < 40 && Color.green(color) < 40 && + Color.alpha(color) > 200 } private fun pixelIsClose(color1: Int, color2: Int): Boolean {