Adding actual color for download badge to attrs

Sorry Carlos

Also setting the third accent color for monet themes to the download badge color
This commit is contained in:
Jays2Kings 2021-08-06 22:40:27 -04:00
parent 8ad2d5ff55
commit 430bc10e4e
8 changed files with 24 additions and 13 deletions

View File

@ -6,7 +6,6 @@ import androidx.core.view.isVisible
import com.google.android.material.card.MaterialCardView
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.UnreadDownloadBadgeBinding
import eu.kanade.tachiyomi.util.system.ImageUtil
import eu.kanade.tachiyomi.util.system.contextCompatColor
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor
@ -55,13 +54,9 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
} else {
downloads.toString()
}
if (ImageUtil.isDarkish(context.getResourceColor(R.attr.colorOnAccent))) {
setTextColor(context.getColor(R.color.download_badge_light_text))
setBackgroundColor(context.getColor(R.color.download_badge_light))
} else {
setTextColor(context.getColor(R.color.download_badge_text))
setBackgroundColor(context.getColor(R.color.download_badge))
}
setTextColor(context.getResourceColor(R.attr.colorOnDownloadBadge))
setBackgroundColor(context.getResourceColor(R.attr.colorDownloadBadge))
}
// Show the badge card if unread or downloads exists

View File

@ -4,6 +4,8 @@
<item name="colorPrimary">@android:color/system_accent2_800</item>
<item name="colorAccent">@android:color/system_accent1_100</item>
<item name="colorAccentText">@android:color/system_accent1_50</item>
<item name="colorDownloadBadge">@android:color/system_accent3_800</item>
<item name="colorOnDownloadBadge">@color/md_white_1000</item>
<item name="colorPrimaryVariant">@android:color/system_neutral1_800</item>
<item name="colorSecondary">@android:color/system_neutral1_900</item>
<item name="background">@android:color/system_neutral1_900</item>

View File

@ -19,6 +19,8 @@
<color name="download">@color/material_green_700</color>
<color name="holo_red">#cc4444</color>
<color name="splashIcon">@color/md_white_1000</color>
<color name="downloadBadgeDayNight">@color/download_badge_light</color>
<color name="colorOnDownloadBadgeDayNight">@color/md_white_1000</color>
<color name="background">#1C1C1D</color>
<color name="dialog">#212121</color>
@ -27,8 +29,7 @@
<!-- Tako Theme -->
<color name="accentTako">#F3B375</color>
<color name="colorOnAccentTako">#242431</color>
<color name="tertiaryTako">@color/colorOnAccentTako</color>
<color name="colorOnTertiaryTako">@color/accentTako</color>
<color name="tabBarIconColorTako">@color/accentTako</color>
<color name="rippleColoredTako">#1FF3B375</color>
<color name="surfaceTako">#2A2A3C</color>
<color name="backgroundTako">#21212E</color>

View File

@ -26,6 +26,8 @@
<item name="android:colorBackground">@color/backgroundLime</item>
<item name="colorSurface">@color/colorAccentLimeText</item>
<item name="colorOnAccent">@color/colorOnLime</item>
<item name="colorDownloadBadge">@color/download_badge_light</item>
<item name="colorOnDownloadBadge">@color/md_white_1000</item>
</style>

View File

@ -3,6 +3,8 @@
<style name="Theme.Tachiyomi.Monet">
<item name="colorPrimary">@android:color/system_accent2_100</item>
<item name="colorAccent">@android:color/system_accent1_500</item>
<item name="colorDownloadBadge">@android:color/system_accent3_300</item>
<item name="colorOnDownloadBadge">@color/black</item>
<item name="colorAccentText">@android:color/system_accent1_800</item>
<item name="colorPrimaryVariant">@android:color/system_accent2_100</item>
<item name="colorSecondary">@android:color/system_neutral1_50</item>

View File

@ -14,6 +14,8 @@
<attr name="actionBarTintColor" format="color"/>
<attr name="readerBackground" format="color"/>
<attr name="colorAccentText" format="color"/>
<attr name="colorDownloadBadge" format="color"/>
<attr name="colorOnDownloadBadge" format="color"/>
<attr name="colorOnAccent" format="color"/>
<attr name="tabBarIconColor" format="reference|integer"/>
<attr name="tabBarIconInactive" format="reference|integer"/>

View File

@ -35,6 +35,8 @@
<color name="background">@color/md_grey_50</color>
<color name="dialog">@color/md_white_1000</color>
<color name="splashIcon">@color/md_black_1000</color>
<color name="downloadBadgeDayNight">@color/download_badge</color>
<color name="colorOnDownloadBadgeDayNight">@color/black</color>
<!-- Text Colors -->
<color name="md_black_1000_87">#DE000000</color>
@ -100,8 +102,7 @@
<!-- Tako Theme -->
<color name="accentTako">#66577E</color>
<color name="colorOnAccentTako">#F3B375</color>
<color name="tertiaryTako">@color/colorOnAccentTako</color>
<color name="colorOnTertiaryTako">#574360</color>
<color name="tabBarIconColorTako">#574360</color>
<color name="rippleColoredTako">#1F66577E</color>
<color name="surfaceTako">#F7F5FF</color>
<color name="backgroundTako">#F2EDF7</color>

View File

@ -15,6 +15,8 @@
<item name="android:windowSplashScreenAnimationDuration" tools:targetApi="31">775</item>
<item name="colorPrimary">@color/app_color_primary</item>
<item name="colorPrimaryVariant">@color/colorPrimary</item>
<item name="colorDownloadBadge">@color/download_badge</item>
<item name="colorOnDownloadBadge">@color/black</item>
<item name="colorSecondary">@color/background</item>
<item name="colorPrimaryDark">?colorPrimary</item>
<item name="colorAccent">@color/colorAccent</item>
@ -116,7 +118,9 @@
<item name="colorAccent">@color/accentTako</item>
<item name="colorOnAccent">@color/colorOnAccentTako</item>
<item name="colorPrimaryVariant">@color/surfaceTako</item>
<item name="tabBarIconColor">@color/colorOnTertiaryTako</item>
<item name="colorDownloadBadge">@color/downloadBadgeDayNight</item>
<item name="colorOnDownloadBadge">@color/colorOnDownloadBadgeDayNight</item>
<item name="tabBarIconColor">@color/tabBarIconColorTako</item>
<item name="colorControlHighlight">@color/rippleColoredTako</item>
<item name="colorSecondary">@color/backgroundTako</item>
<item name="actionBarTintColor">@color/actionTintTako</item>
@ -135,6 +139,8 @@
<!-- Theme colors -->
<item name="colorAccent">@color/colorAccentYinyang</item>
<item name="colorAccentText">@color/colorAccentYinyangText</item>
<item name="colorDownloadBadge">@color/downloadBadgeDayNight</item>
<item name="colorOnDownloadBadge">@color/colorOnDownloadBadgeDayNight</item>
<item name="colorOnAccent">@color/colorOnAccentYinyang</item>
</style>
<style name="Theme.Tachiyomi.Monet"/>