|
| 1 | +package org.schabi.newpipe.ui.theme |
| 2 | + |
| 3 | +import androidx.compose.foundation.isSystemInDarkTheme |
| 4 | +import androidx.compose.material3.MaterialTheme |
| 5 | +import androidx.compose.material3.darkColorScheme |
| 6 | +import androidx.compose.material3.lightColorScheme |
| 7 | +import androidx.compose.runtime.Composable |
| 8 | + |
| 9 | +private val LightColors = lightColorScheme( |
| 10 | + primary = md_theme_light_primary, |
| 11 | + onPrimary = md_theme_light_onPrimary, |
| 12 | + primaryContainer = md_theme_light_primaryContainer, |
| 13 | + onPrimaryContainer = md_theme_light_onPrimaryContainer, |
| 14 | + secondary = md_theme_light_secondary, |
| 15 | + onSecondary = md_theme_light_onSecondary, |
| 16 | + secondaryContainer = md_theme_light_secondaryContainer, |
| 17 | + onSecondaryContainer = md_theme_light_onSecondaryContainer, |
| 18 | + tertiary = md_theme_light_tertiary, |
| 19 | + onTertiary = md_theme_light_onTertiary, |
| 20 | + tertiaryContainer = md_theme_light_tertiaryContainer, |
| 21 | + onTertiaryContainer = md_theme_light_onTertiaryContainer, |
| 22 | + error = md_theme_light_error, |
| 23 | + errorContainer = md_theme_light_errorContainer, |
| 24 | + onError = md_theme_light_onError, |
| 25 | + onErrorContainer = md_theme_light_onErrorContainer, |
| 26 | + background = md_theme_light_background, |
| 27 | + onBackground = md_theme_light_onBackground, |
| 28 | + surface = md_theme_light_surface, |
| 29 | + onSurface = md_theme_light_onSurface, |
| 30 | + surfaceVariant = md_theme_light_surfaceVariant, |
| 31 | + onSurfaceVariant = md_theme_light_onSurfaceVariant, |
| 32 | + outline = md_theme_light_outline, |
| 33 | + inverseOnSurface = md_theme_light_inverseOnSurface, |
| 34 | + inverseSurface = md_theme_light_inverseSurface, |
| 35 | + inversePrimary = md_theme_light_inversePrimary, |
| 36 | + surfaceTint = md_theme_light_surfaceTint, |
| 37 | + outlineVariant = md_theme_light_outlineVariant, |
| 38 | + scrim = md_theme_light_scrim, |
| 39 | +) |
| 40 | + |
| 41 | +private val DarkColors = darkColorScheme( |
| 42 | + primary = md_theme_dark_primary, |
| 43 | + onPrimary = md_theme_dark_onPrimary, |
| 44 | + primaryContainer = md_theme_dark_primaryContainer, |
| 45 | + onPrimaryContainer = md_theme_dark_onPrimaryContainer, |
| 46 | + secondary = md_theme_dark_secondary, |
| 47 | + onSecondary = md_theme_dark_onSecondary, |
| 48 | + secondaryContainer = md_theme_dark_secondaryContainer, |
| 49 | + onSecondaryContainer = md_theme_dark_onSecondaryContainer, |
| 50 | + tertiary = md_theme_dark_tertiary, |
| 51 | + onTertiary = md_theme_dark_onTertiary, |
| 52 | + tertiaryContainer = md_theme_dark_tertiaryContainer, |
| 53 | + onTertiaryContainer = md_theme_dark_onTertiaryContainer, |
| 54 | + error = md_theme_dark_error, |
| 55 | + errorContainer = md_theme_dark_errorContainer, |
| 56 | + onError = md_theme_dark_onError, |
| 57 | + onErrorContainer = md_theme_dark_onErrorContainer, |
| 58 | + background = md_theme_dark_background, |
| 59 | + onBackground = md_theme_dark_onBackground, |
| 60 | + surface = md_theme_dark_surface, |
| 61 | + onSurface = md_theme_dark_onSurface, |
| 62 | + surfaceVariant = md_theme_dark_surfaceVariant, |
| 63 | + onSurfaceVariant = md_theme_dark_onSurfaceVariant, |
| 64 | + outline = md_theme_dark_outline, |
| 65 | + inverseOnSurface = md_theme_dark_inverseOnSurface, |
| 66 | + inverseSurface = md_theme_dark_inverseSurface, |
| 67 | + inversePrimary = md_theme_dark_inversePrimary, |
| 68 | + surfaceTint = md_theme_dark_surfaceTint, |
| 69 | + outlineVariant = md_theme_dark_outlineVariant, |
| 70 | + scrim = md_theme_dark_scrim, |
| 71 | +) |
| 72 | + |
| 73 | +@Composable |
| 74 | +fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { |
| 75 | + MaterialTheme( |
| 76 | + colorScheme = if (useDarkTheme) DarkColors else LightColors, |
| 77 | + content = content |
| 78 | + ) |
| 79 | +} |
0 commit comments