Skip to content

Instantly share code, notes, and snippets.

@shakil807g
Created December 19, 2024 21:22
Show Gist options
  • Save shakil807g/aed5dc790de7064d2727564beb07cca6 to your computer and use it in GitHub Desktop.
Save shakil807g/aed5dc790de7064d2727564beb07cca6 to your computer and use it in GitHub Desktop.
@Immutable
data class CustomColorsPalette(
val divider: Color = Color.Unspecified,
val captionText: Color = Color.Unspecified,
)
val LightCustomColorsPalette = CustomColorsPalette(
divider = Color.Black.copy(alpha = 0.1f),
)
val DarkCustomColorsPalette = CustomColorsPalette(
divider = Color.White.copy(alpha = 0.1f),
)
val MaterialTheme.customColorsPalette: CustomColorsPalette
@Composable
@ReadOnlyComposable
get() = LocalCustomColorsPalette.current
val LocalCustomColorsPalette = staticCompositionLocalOf { CustomColorsPalette() }
Theme(viewState.userSelectedLang, darkTheme) {
CompositionLocalProvider(LocalCustomColorsPalette provides customColorsPalette) {
}
//example
Divider(
Modifier.padding(start = 16.dp),
color = MaterialTheme.customColorsPalette.divider
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment