|
@@ -3,11 +3,7 @@ package com.convenient.android.lib.ui.theme
|
|
|
import android.app.Activity
|
|
|
import android.os.Build
|
|
|
import androidx.compose.foundation.isSystemInDarkTheme
|
|
|
-import androidx.compose.material3.MaterialTheme
|
|
|
-import androidx.compose.material3.darkColorScheme
|
|
|
-import androidx.compose.material3.dynamicDarkColorScheme
|
|
|
-import androidx.compose.material3.dynamicLightColorScheme
|
|
|
-import androidx.compose.material3.lightColorScheme
|
|
|
+import androidx.compose.material3.*
|
|
|
import androidx.compose.runtime.Composable
|
|
|
import androidx.compose.runtime.SideEffect
|
|
|
import androidx.compose.ui.graphics.Color
|
|
@@ -16,21 +12,68 @@ import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.platform.LocalView
|
|
|
import androidx.core.view.ViewCompat
|
|
|
|
|
|
-private val DarkColorScheme = darkColorScheme(
|
|
|
- primary = Purple80,
|
|
|
- secondary = PurpleGrey80,
|
|
|
- tertiary = Pink80
|
|
|
+
|
|
|
+private val LightColors = 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,
|
|
|
+ inversePrimary = md_theme_light_inversePrimary,
|
|
|
+ surfaceTint = md_theme_light_surfaceTint,
|
|
|
+// surfaceTintColor = md_theme_light_surfaceTintColor,
|
|
|
)
|
|
|
|
|
|
-private val LightColorScheme = lightColorScheme(
|
|
|
- primary = Purple80,
|
|
|
- onPrimary = PurpleGrey80,
|
|
|
- secondary = PurpleGrey40,
|
|
|
- tertiary = Pink40,
|
|
|
- primaryContainer = Purple80,
|
|
|
- onPrimaryContainer = Purple80,
|
|
|
- secondaryContainer = Purple80,
|
|
|
- tertiaryContainer = Purple80
|
|
|
+
|
|
|
+private val DarkColors = 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,
|
|
|
+ inversePrimary = md_theme_dark_inversePrimary,
|
|
|
+ surfaceTint = md_theme_dark_surfaceTint,
|
|
|
+// surfaceTintColor = md_theme_dark_surfaceTintColor,
|
|
|
)
|
|
|
|
|
|
@Composable
|
|
@@ -46,20 +89,20 @@ fun SampleTheme(
|
|
|
val context = LocalContext.current
|
|
|
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
|
|
}
|
|
|
- darkTheme -> DarkColorScheme
|
|
|
- else -> LightColorScheme
|
|
|
+ darkTheme -> DarkColors
|
|
|
+ else -> LightColors
|
|
|
}
|
|
|
val view = LocalView.current
|
|
|
if (!view.isInEditMode) {
|
|
|
SideEffect {
|
|
|
- (view.context as Activity).window.statusBarColor = Purple80.toArgb()
|
|
|
+ (view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb()
|
|
|
ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = darkTheme
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- MaterialTheme(
|
|
|
- colorScheme = colorScheme,
|
|
|
- typography = Typography,
|
|
|
- content = content
|
|
|
- )
|
|
|
+ MaterialTheme(
|
|
|
+ colorScheme = colorScheme,
|
|
|
+ typography = AppTypography,
|
|
|
+ content = content
|
|
|
+ )
|
|
|
}
|