Reputation: 109
I develop library with composables. Composables have different foregone colors set for light and dark theme. For example backgroundColor
, buttonColor
, progressLineColor
. I don't want library users to pass any information about theme or colors to composables of library.
What I want is
@Composable
fun SomeLibraryComposable(someText: String) {
// This color should be different for light/dark modes of consumer app
val backgroundColor = getThemedBackroundColor()
....
}
I see that it is possible to add custom themed palette, using staticCompositionLocalOf
, like here. But:
isSystemInDarkMode
is appliable only if app uses system dark modestaticCompositionLocalOf
with my palette to their themedarkMode: Boolean
to composables of library to create corresponding themeUpvotes: 1
Views: 23