|
1 | 1 | package com.yapp.ndgl.core.ui.theme |
2 | 2 |
|
3 | 3 | import androidx.compose.material3.MaterialTheme |
| 4 | +import androidx.compose.material3.Typography |
4 | 5 | import androidx.compose.material3.lightColorScheme |
5 | 6 | import androidx.compose.runtime.Composable |
6 | | -import androidx.compose.ui.res.colorResource |
7 | | -import com.yapp.ndgl.core.ui.R |
| 7 | +import androidx.compose.runtime.CompositionLocalProvider |
| 8 | +import androidx.compose.runtime.ReadOnlyComposable |
8 | 9 |
|
9 | | -private val ColorScheme |
10 | | - @Composable get() = lightColorScheme( |
11 | | - primary = colorResource(R.color.primary_500), |
12 | | - secondary = colorResource(R.color.secondary_500), |
13 | | - background = colorResource(R.color.white), |
14 | | - surface = colorResource(R.color.white) |
15 | | - ) |
| 10 | +object NDGLTheme { |
| 11 | + val colors: NDGLColors |
| 12 | + @Composable |
| 13 | + @ReadOnlyComposable |
| 14 | + get() = LocalNDGLColors.current |
16 | 15 |
|
| 16 | + val typography: NDGLTypography |
| 17 | + @Composable |
| 18 | + @ReadOnlyComposable |
| 19 | + get() = LocalNDGLTypography.current |
| 20 | +} |
17 | 21 |
|
18 | 22 | @Composable |
19 | 23 | fun NDGLTheme( |
20 | | - content: @Composable () -> Unit |
| 24 | + content: @Composable () -> Unit, |
21 | 25 | ) { |
22 | | - MaterialTheme( |
23 | | - colorScheme = ColorScheme, |
24 | | - content = content |
25 | | - ) |
| 26 | + CompositionLocalProvider( |
| 27 | + LocalNDGLColors provides ndglColors, |
| 28 | + LocalNDGLTypography provides ndglTypography, |
| 29 | + ) { |
| 30 | + val colorScheme = lightColorScheme( |
| 31 | + primary = NDGLTheme.colors.primary500, |
| 32 | + secondary = NDGLTheme.colors.secondary500, |
| 33 | + background = NDGLTheme.colors.white, |
| 34 | + surface = NDGLTheme.colors.white, |
| 35 | + ) |
| 36 | + |
| 37 | + val typography = Typography( |
| 38 | + headlineLarge = NDGLTheme.typography.titleLgBold, |
| 39 | + headlineMedium = NDGLTheme.typography.titleMdBold, |
| 40 | + titleLarge = NDGLTheme.typography.subtitleLgSemiBold, |
| 41 | + titleMedium = NDGLTheme.typography.subtitleMdSemiBold, |
| 42 | + bodyLarge = NDGLTheme.typography.bodyLgMedium, |
| 43 | + bodyMedium = NDGLTheme.typography.bodyMdMedium, |
| 44 | + bodySmall = NDGLTheme.typography.bodyMdRegular, |
| 45 | + labelLarge = NDGLTheme.typography.bodySmSemiBold, |
| 46 | + labelMedium = NDGLTheme.typography.bodySmMedium, |
| 47 | + labelSmall = NDGLTheme.typography.bodySmRegular, |
| 48 | + ) |
| 49 | + |
| 50 | + MaterialTheme( |
| 51 | + colorScheme = colorScheme, |
| 52 | + typography = typography, |
| 53 | + content = content, |
| 54 | + ) |
| 55 | + } |
26 | 56 | } |
0 commit comments