diff --git a/app/src/main/kotlin/com/imashnake/animite/dev/ext/ColorSchemeExt.kt b/app/src/main/kotlin/com/imashnake/animite/dev/ext/ColorSchemeExt.kt deleted file mode 100644 index cb00ef30..00000000 --- a/app/src/main/kotlin/com/imashnake/animite/dev/ext/ColorSchemeExt.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.imashnake.animite.dev.ext - -import androidx.compose.material3.ColorScheme - -fun ColorScheme.pastelize(backgroundToPrimary: Float) = with(this) { - copy(background = background.blendWith(primary, backgroundToPrimary)) -} diff --git a/app/src/main/kotlin/com/imashnake/animite/features/media/MediaThemeUtil.kt b/app/src/main/kotlin/com/imashnake/animite/features/media/MediaThemeUtil.kt index 4ee42cc5..9ae7c6d1 100644 --- a/app/src/main/kotlin/com/imashnake/animite/features/media/MediaThemeUtil.kt +++ b/app/src/main/kotlin/com/imashnake/animite/features/media/MediaThemeUtil.kt @@ -5,8 +5,7 @@ import androidx.compose.material3.ColorScheme import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color -import com.imashnake.animite.core.Constants.PASTELIZE_RATIO -import com.imashnake.animite.dev.ext.pastelize +import com.materialkolor.PaletteStyle import com.materialkolor.rememberDynamicColorScheme /** @@ -22,9 +21,11 @@ fun rememberColorSchemeFor( color: Int?, fallbackColorScheme: ColorScheme = MaterialTheme.colorScheme, isDark: Boolean = isSystemInDarkTheme() -): ColorScheme { - return color?.let { - rememberDynamicColorScheme(Color(it), isDark = isDark, isAmoled = false) - .pastelize(PASTELIZE_RATIO) - } ?: fallbackColorScheme -} +) = color?.let { + rememberDynamicColorScheme( + seedColor = Color(it), + isDark = isDark, + isAmoled = false, + style = PaletteStyle.Vibrant, + ) +} ?: fallbackColorScheme diff --git a/app/src/main/kotlin/com/imashnake/animite/features/theme/Color.kt b/app/src/main/kotlin/com/imashnake/animite/features/theme/Color.kt deleted file mode 100644 index a6bfac78..00000000 --- a/app/src/main/kotlin/com/imashnake/animite/features/theme/Color.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.imashnake.animite.features.theme - -import androidx.compose.material3.ColorScheme -import androidx.compose.ui.graphics.Color - -val KimiNoDarkColorScheme = ColorScheme( - primary = Color(0xFF99CBFF), - onPrimary = Color(0xFF003355), - primaryContainer = Color(0xFF004A78), - onPrimaryContainer = Color(0xFFCFE5FF), - inversePrimary = Color(0xFF00629E), - secondary = Color(0xFFB9C6EA), - onSecondary = Color(0xFF23304D), - secondaryContainer = Color(0xFF3A4664), - onSecondaryContainer = Color(0xFFD9E2FF), - tertiary = Color(0xFFC2C2F9), - onTertiary = Color(0xFF2B2B59), - tertiaryContainer = Color(0xFF414271), - onTertiaryContainer = Color(0xFFE1DFFF), - background = Color(0xFF151C24), - onBackground = Color(0xFFDCE3EE), - surface = Color(0xFF151C24), - onSurface = Color(0xFFDCE3EE), - surfaceVariant = Color(0xFF3F4852), - onSurfaceVariant = Color(0xFFBEC7D4), - surfaceTint = Color(0xFF99CBFF), - inverseSurface = Color(0xFFDCE3EE), - inverseOnSurface = Color(0xFF2A3139), - error = Color(0xFFF2B8B5), - onError = Color(0xFF601410), - errorContainer = Color(0xFF8C1D18), - onErrorContainer = Color(0xFFF2B8B5), - outline = Color(0xFF88919E), - outlineVariant = Color(0xFF49454F), - scrim = Color(0xFF000000), -) - -val KimiNoLightColorScheme = ColorScheme( - primary = Color(0xFF00629E), - onPrimary = Color(0xFFFFFFFF), - primaryContainer = Color(0xFFCFE5FF), - onPrimaryContainer = Color(0xFF001D34), - inversePrimary = Color(0xFF99CBFF), - secondary = Color(0xFF525E7D), - onSecondary = Color(0xFFFFFFFF), - secondaryContainer = Color(0xFFD9E2FF), - onSecondaryContainer = Color(0xFF0D1B37), - tertiary = Color(0xFF595A8B), - onTertiary = Color(0xFFFFFFFF), - tertiaryContainer = Color(0xFFE1DFFF), - onTertiaryContainer = Color(0xFF151643), - background = Color(0xFFFCFCFF), - onBackground = Color(0xFF151C24), - surface = Color(0xFFFCFCFF), - onSurface = Color(0xFF151C24), - surfaceVariant = Color(0xFFDAE3F1), - onSurfaceVariant = Color(0xFF3F4852), - surfaceTint = Color(0xFF00629E), - inverseSurface = Color(0xFF2A3139), - inverseOnSurface = Color(0xFFEBF1FC), - error = Color(0xFFB3261E), - onError = Color(0xFFFFFFFF), - errorContainer = Color(0xFFF9DEDC), - onErrorContainer = Color(0xFF410E0B), - outline = Color(0xFF6E7783), - outlineVariant = Color(0xFFCAC4D0), - scrim = Color(0xFF000000), -) diff --git a/app/src/main/kotlin/com/imashnake/animite/features/theme/Theme.kt b/app/src/main/kotlin/com/imashnake/animite/features/theme/Theme.kt index d6fefc99..414704ee 100644 --- a/app/src/main/kotlin/com/imashnake/animite/features/theme/Theme.kt +++ b/app/src/main/kotlin/com/imashnake/animite/features/theme/Theme.kt @@ -11,47 +11,52 @@ import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext -import com.imashnake.animite.core.Constants.PASTELIZE_RATIO import com.imashnake.animite.core.ui.LocalPaddings import com.imashnake.animite.core.ui.Paddings import com.imashnake.animite.core.ui.rememberDefaultPaddings -import com.imashnake.animite.dev.ext.pastelize +import com.materialkolor.PaletteStyle +import com.materialkolor.rememberDynamicColorScheme @OptIn(ExperimentalMaterial3Api::class) @Composable fun AnimiteTheme( paddings: Paddings = rememberDefaultPaddings(), - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { val dynamicColor = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S - val darkTheme = isSystemInDarkTheme() + val useDarkTheme = isSystemInDarkTheme() val animiteColorScheme = when { - dynamicColor && darkTheme -> dynamicDarkColorScheme(LocalContext.current) - dynamicColor && !darkTheme -> dynamicLightColorScheme(LocalContext.current) - .pastelize(PASTELIZE_RATIO) - darkTheme -> KimiNoDarkColorScheme - else -> KimiNoLightColorScheme - .pastelize(PASTELIZE_RATIO) + dynamicColor && useDarkTheme -> dynamicDarkColorScheme(LocalContext.current) + dynamicColor && !useDarkTheme -> dynamicLightColorScheme(LocalContext.current) + else -> rememberDynamicColorScheme( + seedColor = Color(0xFF2D7AB0), + secondary = Color(0xFF687797), + isDark = useDarkTheme, + isAmoled = false, + style = PaletteStyle.Vibrant, + ) } + val animiteRippleTheme = RippleConfiguration( color = MaterialTheme.colorScheme.primary, rippleAlpha = RippleAlpha( draggedAlpha = 0.16f, focusedAlpha = 0.12f, hoveredAlpha = 0.08f, - pressedAlpha = 0.12f + pressedAlpha = 0.12f, ) ) MaterialTheme( colorScheme = animiteColorScheme, - typography = AnimiteTypography + typography = AnimiteTypography, ) { CompositionLocalProvider( LocalRippleConfiguration provides animiteRippleTheme, LocalPaddings provides paddings, - content = content + content = content, ) } } diff --git a/core/src/main/kotlin/com/imashnake/animite/core/Constants.kt b/core/src/main/kotlin/com/imashnake/animite/core/Constants.kt index d13eeb54..5efd860d 100644 --- a/core/src/main/kotlin/com/imashnake/animite/core/Constants.kt +++ b/core/src/main/kotlin/com/imashnake/animite/core/Constants.kt @@ -4,6 +4,4 @@ object Constants { const val ANILIST_BASE_URL = "https://graphql.anilist.co/" const val CROSSFADE_DURATION = 500 const val MEDIA_TYPE = "mediaType" - - const val PASTELIZE_RATIO = 0.05f } diff --git a/core/src/main/kotlin/com/imashnake/animite/core/ui/MediaSmall.kt b/core/src/main/kotlin/com/imashnake/animite/core/ui/MediaSmall.kt index 3cac5fe2..c4869b55 100644 --- a/core/src/main/kotlin/com/imashnake/animite/core/ui/MediaSmall.kt +++ b/core/src/main/kotlin/com/imashnake/animite/core/ui/MediaSmall.kt @@ -16,7 +16,6 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card -import androidx.compose.material3.CardDefaults import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -104,12 +103,9 @@ fun MediaSmall( label: String? = null, ) { Card( - modifier = modifier.width(cardWidth), onClick = onClick, - colors = CardDefaults.cardColors( - containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.3f) - ), - shape = RoundedCornerShape(dimensionResource(R.dimen.media_card_corner_radius)) + shape = RoundedCornerShape(dimensionResource(R.dimen.media_card_corner_radius)), + modifier = modifier.width(cardWidth), ) { AsyncImage( model = crossfadeModel(image),