From 7f0ae95dfb674395185111ed1c04d31636611a61 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Mon, 31 Mar 2025 13:57:05 +0800 Subject: [PATCH] Improve font color blending and contrast in dark mode. Fix login issue (#19). Modify styles for more settings. Do not show the status of susfs when using lkm mode. Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> --- .../shirkneko/zako/sukisu/ui/screen/Home.kt | 20 +++++++------- .../zako/sukisu/ui/screen/Settings.kt | 5 ++-- .../shirkneko/zako/sukisu/ui/theme/Theme.kt | 26 ++++++++++++------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt index 852f6079..5e0c162d 100644 --- a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt +++ b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt @@ -335,16 +335,18 @@ private fun StatusCard( Spacer(modifier = Modifier.height(4.dp)) val suSFS = getSuSFS() - val translatedStatus = when (suSFS) { - "Supported" -> stringResource(R.string.status_supported) - "Not Supported" -> stringResource(R.string.status_not_supported) - else -> stringResource(R.string.status_unknown) - } + if (lkmMode != true) { + val translatedStatus = when (suSFS) { + "Supported" -> stringResource(R.string.status_supported) + "Not Supported" -> stringResource(R.string.status_not_supported) + else -> stringResource(R.string.status_unknown) + } - Text( - text = stringResource(R.string.home_susfs, translatedStatus), - style = MaterialTheme.typography.bodyMedium - ) + Text( + text = stringResource(R.string.home_susfs, translatedStatus), + style = MaterialTheme.typography.bodyMedium + ) + } } } diff --git a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Settings.kt b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Settings.kt index 91188050..c17482ef 100644 --- a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Settings.kt +++ b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Settings.kt @@ -140,7 +140,6 @@ fun SettingScreen(navigator: DestinationsNavigator) { loadingDialog.hide() snackBarHost.showSnackbar(context.getString(R.string.log_saved)) } - // endregion } // region 配置项列表 // 配置文件模板入口 @@ -218,12 +217,12 @@ fun SettingScreen(navigator: DestinationsNavigator) { prefs.edit { putBoolean("enable_web_debugging", it) } enableWebDebugging = it } - // endregion + // 更多设置 val newButtonTitle = stringResource(id = R.string.more_settings) ListItem( leadingContent = { Icon( - Icons.Filled.ExpandMore, + Icons.Filled.Settings, contentDescription = newButtonTitle ) }, diff --git a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/theme/Theme.kt b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/theme/Theme.kt index 41e52161..4ac64ad5 100644 --- a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/theme/Theme.kt +++ b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/theme/Theme.kt @@ -43,23 +43,23 @@ object ThemeConfig { @Composable private fun getDarkColorScheme() = darkColorScheme( primary = ThemeConfig.currentTheme.Primary.copy(alpha = 0.8f), - onPrimary = Color.White, + onPrimary = mixColors(ThemeConfig.currentTheme.Primary, Color.White, 0.2f), primaryContainer = ThemeConfig.currentTheme.PrimaryContainer.copy(alpha = 0.15f), - onPrimaryContainer = Color.White, + onPrimaryContainer = mixColors(ThemeConfig.currentTheme.Primary, Color.White, 0.2f), secondary = ThemeConfig.currentTheme.Secondary.copy(alpha = 0.8f), - onSecondary = Color.White, + onSecondary = mixColors(ThemeConfig.currentTheme.Secondary, Color.White, 0.2f), secondaryContainer = ThemeConfig.currentTheme.SecondaryContainer.copy(alpha = 0.15f), - onSecondaryContainer = Color.White, + onSecondaryContainer = mixColors(ThemeConfig.currentTheme.Secondary, Color.White, 0.2f), tertiary = ThemeConfig.currentTheme.Tertiary.copy(alpha = 0.8f), - onTertiary = Color.White, + onTertiary = mixColors(ThemeConfig.currentTheme.Tertiary, Color.White, 0.2f), tertiaryContainer = ThemeConfig.currentTheme.TertiaryContainer.copy(alpha = 0.15f), - onTertiaryContainer = Color.White, + onTertiaryContainer = mixColors(ThemeConfig.currentTheme.Tertiary, Color.White, 0.2f), background = Color.Transparent, surface = Color.Transparent, - onBackground = Color.White.copy(alpha = 0.87f), - onSurface = Color.White.copy(alpha = 0.87f), + onBackground = mixColors(ThemeConfig.currentTheme.Primary, Color.White, 0.1f), + onSurface = mixColors(ThemeConfig.currentTheme.Primary, Color.White, 0.1f), surfaceVariant = Color(0xFF2F2F2F), - onSurfaceVariant = Color.White.copy(alpha = 0.78f), + onSurfaceVariant = mixColors(ThemeConfig.currentTheme.Primary, Color.White, 0.2f), outline = Color.White.copy(alpha = 0.12f), outlineVariant = Color.White.copy(alpha = 0.12f) ) @@ -339,4 +339,12 @@ private fun adjustColor(color: Color): Color { luminance = maxLuminance } return color.copy(luminance) +} + +private fun mixColors(color1: Color, color2: Color, ratio: Float): Color { + val r = (color1.red * ratio + color2.red * (1 - ratio)) + val g = (color1.green * ratio + color2.green * (1 - ratio)) + val b = (color1.blue * ratio + color2.blue * (1 - ratio)) + val a = (color1.alpha * ratio + color2.alpha * (1 - ratio)) + return Color(r, g, b, a) } \ No newline at end of file