style(chapter): Adjust contrast

This commit is contained in:
Ahmad Ansori Palembani 2024-12-11 11:22:42 +07:00
parent 87c13b44ab
commit 8e7f5d8897
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 9 additions and 6 deletions

View file

@ -11,6 +11,9 @@ The format is simplified version of [Keep a Changelog](https://keepachangelog.co
## [Unreleased]
### Changes
- Adjust chapter title-details contrast
## [1.9.1]
### Fixes

View file

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.util.chapter
import android.content.Context
import android.content.res.ColorStateList
import android.widget.TextView
import androidx.core.graphics.ColorUtils
import androidx.core.widget.TextViewCompat
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import eu.kanade.tachiyomi.R
@ -102,11 +103,10 @@ class ChapterUtil {
private fun readColor(context: Context): Int = context.contextCompatColor(R.color.read_chapter)
private fun unreadColor(context: Context, secondary: Boolean = false): Int =
if (!secondary) {
context.getResourceColor(R.attr.colorOnBackground)
} else {
context.getResourceColor(android.R.attr.textColorSecondary)
private fun unreadColor(context: Context, secondary: Boolean = false): Int {
val color = context.getResourceColor(R.attr.colorOnSurface)
// 78% alpha for chapter details, 100% for chapter number/title
return ColorUtils.setAlphaComponent(color, if (secondary) 198 else 255)
}
private fun bookmarkedColor(context: Context): Int = context.getResourceColor(R.attr.colorSecondary)