Harmonize background color in favicon fallback

This commit is contained in:
Zakhar Timoshenko
2022-07-12 19:28:52 +03:00
parent 4ba1e2f661
commit aed180c845

View File

@@ -4,6 +4,9 @@ import android.content.Context
import android.graphics.*
import android.graphics.drawable.Drawable
import androidx.core.graphics.ColorUtils
import com.google.android.material.color.MaterialColors
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.utils.ext.getThemeColor
import kotlin.math.absoluteValue
class FaviconFallbackDrawable(
@@ -13,7 +16,7 @@ class FaviconFallbackDrawable(
private val paint = Paint(Paint.ANTI_ALIAS_FLAG)
private val letter = name.take(1).uppercase()
private val color = colorOfString(name)
private val color = MaterialColors.harmonize(colorOfString(name), context.getThemeColor(android.R.attr.colorPrimary))
private val textBounds = Rect()
private val tempRect = Rect()