From bce6af62fcbb20d521a137712cddc2e9bbaeaaf8 Mon Sep 17 00:00:00 2001 From: Luqman Date: Mon, 8 Jan 2024 03:20:08 +0700 Subject: [PATCH] Add Nord Theme (#10308) * Add Nord Theme * update * update error color * update comment --- .../eu/kanade/domain/ui/model/AppTheme.kt | 1 + .../presentation/theme/TachiyomiTheme.kt | 2 + .../theme/colorscheme/NordColorScheme.kt | 72 +++++++++++++++++++ .../ui/base/delegate/ThemingDelegate.kt | 3 + app/src/main/res/values/themes.xml | 31 ++++++++ .../commonMain/resources/MR/base/strings.xml | 1 + .../src/main/res/values-night/colors_nord.xml | 30 ++++++++ .../src/main/res/values/colors_nord.xml | 31 ++++++++ 8 files changed, 171 insertions(+) create mode 100644 app/src/main/java/eu/kanade/presentation/theme/colorscheme/NordColorScheme.kt create mode 100644 presentation-core/src/main/res/values-night/colors_nord.xml create mode 100644 presentation-core/src/main/res/values/colors_nord.xml diff --git a/app/src/main/java/eu/kanade/domain/ui/model/AppTheme.kt b/app/src/main/java/eu/kanade/domain/ui/model/AppTheme.kt index 2fdeb0e3c..06194f8c9 100644 --- a/app/src/main/java/eu/kanade/domain/ui/model/AppTheme.kt +++ b/app/src/main/java/eu/kanade/domain/ui/model/AppTheme.kt @@ -9,6 +9,7 @@ enum class AppTheme(val titleRes: StringResource?) { GREEN_APPLE(MR.strings.theme_greenapple), LAVENDER(MR.strings.theme_lavender), MIDNIGHT_DUSK(MR.strings.theme_midnightdusk), + NORD(MR.strings.theme_nord), STRAWBERRY_DAIQUIRI(MR.strings.theme_strawberrydaiquiri), TAKO(MR.strings.theme_tako), TEALTURQUOISE(MR.strings.theme_tealturquoise), diff --git a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt index c464ceb3a..fd650f53c 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt @@ -12,6 +12,7 @@ import eu.kanade.presentation.theme.colorscheme.GreenAppleColorScheme import eu.kanade.presentation.theme.colorscheme.LavenderColorScheme import eu.kanade.presentation.theme.colorscheme.MidnightDuskColorScheme import eu.kanade.presentation.theme.colorscheme.MonetColorScheme +import eu.kanade.presentation.theme.colorscheme.NordColorScheme import eu.kanade.presentation.theme.colorscheme.StrawberryColorScheme import eu.kanade.presentation.theme.colorscheme.TachiyomiColorScheme import eu.kanade.presentation.theme.colorscheme.TakoColorScheme @@ -47,6 +48,7 @@ private fun getThemeColorScheme( AppTheme.GREEN_APPLE -> GreenAppleColorScheme AppTheme.LAVENDER -> LavenderColorScheme AppTheme.MIDNIGHT_DUSK -> MidnightDuskColorScheme + AppTheme.NORD -> NordColorScheme AppTheme.STRAWBERRY_DAIQUIRI -> StrawberryColorScheme AppTheme.TAKO -> TakoColorScheme AppTheme.TEALTURQUOISE -> TealTurqoiseColorScheme diff --git a/app/src/main/java/eu/kanade/presentation/theme/colorscheme/NordColorScheme.kt b/app/src/main/java/eu/kanade/presentation/theme/colorscheme/NordColorScheme.kt new file mode 100644 index 000000000..d493e2d62 --- /dev/null +++ b/app/src/main/java/eu/kanade/presentation/theme/colorscheme/NordColorScheme.kt @@ -0,0 +1,72 @@ +package eu.kanade.presentation.theme.colorscheme + +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.ui.graphics.Color + +/** + * Colors for Nord theme + * https://www.nordtheme.com/docs/colors-and-palettes + * for the light theme, the primary color is switched with the tertiary for better contrast in some case + */ +internal object NordColorScheme : BaseColorScheme() { + + override val darkScheme = darkColorScheme( + primary = Color(0xFF88C0D0), + onPrimary = Color(0xFF2E3440), + primaryContainer = Color(0xFF88C0D0), + onPrimaryContainer = Color(0xFF2E3440), + inversePrimary = Color(0xFF397E91), + secondary = Color(0xFF81A1C1), + onSecondary = Color(0xFF2E3440), + secondaryContainer = Color(0xFF81A1C1), + onSecondaryContainer = Color(0xFF2E3440), + tertiary = Color(0xFF5E81AC), + onTertiary = Color(0xFF000000), + tertiaryContainer = Color(0xFF5E81AC), + onTertiaryContainer = Color(0xFF000000), + background = Color(0xFF2E3440), + onBackground = Color(0xFFECEFF4), + surface = Color(0xFF3B4252), + onSurface = Color(0xFFECEFF4), + surfaceVariant = Color(0xFF2E3440), + onSurfaceVariant = Color(0xFFECEFF4), + surfaceTint = Color(0xFF88C0D0), + inverseSurface = Color(0xFFD8DEE9), + inverseOnSurface = Color(0xFF2E3440), + outline = Color(0xFF6d717b), + outlineVariant = Color(0xFF90939a), + onError = Color(0xFF2E3440), + errorContainer = Color(0xFFBF616A), + onErrorContainer = Color(0xFF000000), + ) + + override val lightScheme = lightColorScheme( + primary = Color(0xFF5E81AC), + onPrimary = Color(0xFF000000), + primaryContainer = Color(0xFF5E81AC), + onPrimaryContainer = Color(0xFF000000), + inversePrimary = Color(0xFF8CA8CD), + secondary = Color(0xFF81A1C1), + onSecondary = Color(0xFF2E3440), + secondaryContainer = Color(0xFF81A1C1), + onSecondaryContainer = Color(0xFF2E3440), + tertiary = Color(0xFF88C0D0), + onTertiary = Color(0xFF2E3440), + tertiaryContainer = Color(0xFF88C0D0), + onTertiaryContainer = Color(0xFF2E3440), + background = Color(0xFFECEFF4), + onBackground = Color(0xFF2E3440), + surface = Color(0xFFE5E9F0), + onSurface = Color(0xFF2E3440), + surfaceVariant = Color(0xFFffffff), + onSurfaceVariant = Color(0xFF2E3440), + surfaceTint = Color(0xFF5E81AC), + inverseSurface = Color(0xFF3B4252), + inverseOnSurface = Color(0xFFECEFF4), + outline = Color(0xFF2E3440), + onError = Color(0xFFECEFF4), + errorContainer = Color(0xFFBF616A), + onErrorContainer = Color(0xFF000000), + ) +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt index c8846a34c..c792333e9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt @@ -26,6 +26,9 @@ interface ThemingDelegate { AppTheme.MIDNIGHT_DUSK -> { resIds += R.style.Theme_Tachiyomi_MidnightDusk } + AppTheme.NORD -> { + resIds += R.style.Theme_Tachiyomi_Nord + } AppTheme.STRAWBERRY_DAIQUIRI -> { resIds += R.style.Theme_Tachiyomi_StrawberryDaiquiri } diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index b61c34eb9..f6597c58b 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -333,6 +333,37 @@ @color/tidalwave_primaryInverse + + +