|
| 1 | +package com.hackeros.app.ui.theme |
| 2 | + |
| 3 | +import androidx.compose.material3.MaterialTheme |
| 4 | +import androidx.compose.material3.darkColorScheme |
| 5 | +import androidx.compose.runtime.Composable |
| 6 | +import androidx.compose.runtime.CompositionLocalProvider |
| 7 | +import androidx.compose.runtime.compositionLocalOf |
| 8 | +import androidx.compose.ui.graphics.Color |
| 9 | +import com.hackeros.app.data.model.AppTheme |
| 10 | +import com.hackeros.app.data.model.ThemeId |
| 11 | + |
| 12 | +val LocalAppTheme = compositionLocalOf<AppTheme> { THEMES[ThemeId.HACKER]!! } |
| 13 | + |
| 14 | +@Composable |
| 15 | +fun HackerOSTheme( |
| 16 | + appTheme: AppTheme, |
| 17 | + content: @Composable () -> Unit |
| 18 | +) { |
| 19 | + val colorScheme = darkColorScheme( |
| 20 | + primary = appTheme.primaryColor(), |
| 21 | + background = appTheme.backgroundColor(), |
| 22 | + surface = appTheme.cardColor(), |
| 23 | + onPrimary = appTheme.backgroundColor(), |
| 24 | + onBackground = appTheme.textColor(), |
| 25 | + onSurface = appTheme.textColor(), |
| 26 | + secondary = appTheme.primaryColor(), |
| 27 | + onSecondary = appTheme.backgroundColor(), |
| 28 | + ) |
| 29 | + |
| 30 | + CompositionLocalProvider(LocalAppTheme provides appTheme) { |
| 31 | + MaterialTheme( |
| 32 | + colorScheme = colorScheme, |
| 33 | + typography = AppTypography, |
| 34 | + content = content |
| 35 | + ) |
| 36 | + } |
| 37 | +} |
0 commit comments