Created
December 19, 2024 21:22
-
-
Save shakil807g/aed5dc790de7064d2727564beb07cca6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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