brighten a bit more when color is really dark

This commit is contained in:
Helium314 2023-09-13 12:33:48 +02:00
parent 5dbf6c5e60
commit 726e923f79

View file

@ -36,7 +36,11 @@ fun adjustLuminosityAndKeepAlpha(@ColorInt color: Int, amount: Float): Int {
}
@ColorInt
fun brighten(@ColorInt color: Int) = adjustLuminosityAndKeepAlpha(color, 0.06f)
fun brighten(@ColorInt color: Int) =
if (Color.red(color) < 20 && Color.green(color) < 15 && Color.blue(color) < 25)
adjustLuminosityAndKeepAlpha(color, 0.09f) // really dark colors need more brightening
else
adjustLuminosityAndKeepAlpha(color, 0.06f)
@ColorInt
fun darken(@ColorInt color: Int) = adjustLuminosityAndKeepAlpha(color, -0.06f)