diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2021-11-01 01:47:34 +0530 |
|---|---|---|
| committer | Harsh Shandilya <me@msfjarvis.dev> | 2021-11-03 15:07:00 +0530 |
| commit | 0834c979a5c6a41106282ffc8a8be72255f780fa (patch) | |
| tree | b69ea97ce2b5eab290f78d749001f0384deed788 /app/src/main/java/dev/msfjarvis/aps/ui/theme/Theme.kt | |
| parent | 494cb5fc4fbe90d7a4b27e1d1114cb20840883d3 (diff) | |
| download | HardenedPass-0834c979a5c6a41106282ffc8a8be72255f780fa.tar.gz HardenedPass-0834c979a5c6a41106282ffc8a8be72255f780fa.zip | |
app: add Material3 themes
Diffstat (limited to 'app/src/main/java/dev/msfjarvis/aps/ui/theme/Theme.kt')
| -rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/ui/theme/Theme.kt | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/theme/Theme.kt b/app/src/main/java/dev/msfjarvis/aps/ui/theme/Theme.kt new file mode 100644 index 00000000..55fb600d --- /dev/null +++ b/app/src/main/java/dev/msfjarvis/aps/ui/theme/Theme.kt @@ -0,0 +1,76 @@ +package dev.msfjarvis.aps.ui.theme + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable + +private val LightThemeColors = + lightColorScheme( + primary = md_theme_light_primary, + onPrimary = md_theme_light_onPrimary, + primaryContainer = md_theme_light_primaryContainer, + onPrimaryContainer = md_theme_light_onPrimaryContainer, + secondary = md_theme_light_secondary, + onSecondary = md_theme_light_onSecondary, + secondaryContainer = md_theme_light_secondaryContainer, + onSecondaryContainer = md_theme_light_onSecondaryContainer, + tertiary = md_theme_light_tertiary, + onTertiary = md_theme_light_onTertiary, + tertiaryContainer = md_theme_light_tertiaryContainer, + onTertiaryContainer = md_theme_light_onTertiaryContainer, + error = md_theme_light_error, + errorContainer = md_theme_light_errorContainer, + onError = md_theme_light_onError, + onErrorContainer = md_theme_light_onErrorContainer, + background = md_theme_light_background, + onBackground = md_theme_light_onBackground, + surface = md_theme_light_surface, + onSurface = md_theme_light_onSurface, + surfaceVariant = md_theme_light_surfaceVariant, + onSurfaceVariant = md_theme_light_onSurfaceVariant, + outline = md_theme_light_outline, + inverseOnSurface = md_theme_light_inverseOnSurface, + inverseSurface = md_theme_light_inverseSurface, + ) +private val DarkThemeColors = + darkColorScheme( + primary = md_theme_dark_primary, + onPrimary = md_theme_dark_onPrimary, + primaryContainer = md_theme_dark_primaryContainer, + onPrimaryContainer = md_theme_dark_onPrimaryContainer, + secondary = md_theme_dark_secondary, + onSecondary = md_theme_dark_onSecondary, + secondaryContainer = md_theme_dark_secondaryContainer, + onSecondaryContainer = md_theme_dark_onSecondaryContainer, + tertiary = md_theme_dark_tertiary, + onTertiary = md_theme_dark_onTertiary, + tertiaryContainer = md_theme_dark_tertiaryContainer, + onTertiaryContainer = md_theme_dark_onTertiaryContainer, + error = md_theme_dark_error, + errorContainer = md_theme_dark_errorContainer, + onError = md_theme_dark_onError, + onErrorContainer = md_theme_dark_onErrorContainer, + background = md_theme_dark_background, + onBackground = md_theme_dark_onBackground, + surface = md_theme_dark_surface, + onSurface = md_theme_dark_onSurface, + surfaceVariant = md_theme_dark_surfaceVariant, + onSurfaceVariant = md_theme_dark_onSurfaceVariant, + outline = md_theme_dark_outline, + inverseOnSurface = md_theme_dark_inverseOnSurface, + inverseSurface = md_theme_dark_inverseSurface, + ) + +@Composable +fun APSTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { + val colors = + if (!useDarkTheme) { + LightThemeColors + } else { + DarkThemeColors + } + + MaterialTheme(colorScheme = colors, typography = AppTypography, content = content) +} |
