|
1 | 1 | package com.everymeal.presentation.ui.theme
|
2 | 2 |
|
3 |
| -import android.app.Activity |
4 |
| -import android.os.Build |
5 |
| -import androidx.compose.foundation.isSystemInDarkTheme |
6 | 3 | import androidx.compose.material3.MaterialTheme
|
7 |
| -import androidx.compose.material3.darkColorScheme |
8 |
| -import androidx.compose.material3.dynamicDarkColorScheme |
9 |
| -import androidx.compose.material3.dynamicLightColorScheme |
10 | 4 | import androidx.compose.material3.lightColorScheme
|
11 | 5 | import androidx.compose.runtime.Composable
|
12 |
| -import androidx.compose.runtime.SideEffect |
13 |
| -import androidx.compose.ui.graphics.toArgb |
14 |
| -import androidx.compose.ui.platform.LocalContext |
15 |
| -import androidx.compose.ui.platform.LocalView |
16 |
| -import androidx.core.view.WindowCompat |
17 |
| - |
18 |
| -private val DarkColorScheme = darkColorScheme( |
19 |
| - primary = Purple80, |
20 |
| - secondary = PurpleGrey80, |
21 |
| - tertiary = Pink80 |
22 |
| -) |
| 6 | +import androidx.compose.ui.graphics.Color |
23 | 7 |
|
24 | 8 | private val LightColorScheme = lightColorScheme(
|
25 | 9 | primary = Purple40,
|
26 | 10 | secondary = PurpleGrey40,
|
27 |
| - tertiary = Pink40 |
28 |
| - |
29 |
| - /* Other default colors to override |
30 |
| - background = Color(0xFFFFFBFE), |
31 |
| - surface = Color(0xFFFFFBFE), |
32 |
| - onPrimary = Color.White, |
33 |
| - onSecondary = Color.White, |
34 |
| - onTertiary = Color.White, |
35 |
| - onBackground = Color(0xFF1C1B1F), |
36 |
| - onSurface = Color(0xFF1C1B1F), |
37 |
| - */ |
| 11 | + tertiary = Pink40, |
| 12 | + background = Color.White, |
| 13 | + onBackground = Color.Black, |
38 | 14 | )
|
39 | 15 |
|
40 | 16 | @Composable
|
41 | 17 | fun EveryMeal_AndroidTheme(
|
42 |
| - darkTheme: Boolean = isSystemInDarkTheme(), |
43 |
| - // Dynamic color is available on Android 12+ |
44 |
| - dynamicColor: Boolean = true, |
45 | 18 | content: @Composable () -> Unit
|
46 | 19 | ) {
|
47 |
| - val colorScheme = when { |
48 |
| - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { |
49 |
| - val context = LocalContext.current |
50 |
| - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) |
51 |
| - } |
52 |
| - |
53 |
| - darkTheme -> DarkColorScheme |
54 |
| - else -> LightColorScheme |
55 |
| - } |
56 |
| - val view = LocalView.current |
57 |
| - if (!view.isInEditMode) { |
58 |
| - SideEffect { |
59 |
| - val window = (view.context as Activity).window |
60 |
| - window.statusBarColor = colorScheme.primary.toArgb() |
61 |
| - WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme |
62 |
| - } |
63 |
| - } |
| 20 | + val colorScheme = LightColorScheme |
64 | 21 |
|
65 | 22 | MaterialTheme(
|
66 | 23 | colorScheme = colorScheme,
|
| 24 | + shapes = Shapes, |
67 | 25 | typography = Typography,
|
68 | 26 | content = content
|
69 | 27 | )
|
|
0 commit comments