Pablo
05/12/2025, 1:55 PMprovideContent {
GlanceTheme(
// Using colors from app theme
colors = ColorProviders(light = lightScheme,dark = darkScheme)
) {
MyContent()
}
}
is ignoring primary and onPrimary, for example I need to do this to force white text in my texts:
Text(style = TextStyle(color = GlanceTheme.colors.onPrimary))
is this normal? to be mandatory to set manually every color of the theme in every composable used in glance?bbade_
05/20/2025, 9:25 PMstyle
for text will be TextDefaults.defaultTextStyle
, which is black.
There's a couple things you could do
Create an @Composable val myTextStyle get() = [...]
that resolves the desired text color at runtime.
Create your own component that wraps Text()
and initializes it the way you'd like.
File a bug/feature request https://issuetracker.google.com/issues?q=status:open%20componentid:1097239
@Composable
public fun Text(
text: String,
modifier: GlanceModifier = GlanceModifier,
style: TextStyle = defaultTextStyle,
maxLines: Int = Int.MAX_VALUE,
) {
[...]
}
public object TextDefaults {
public val defaultTextColor: ColorProvider = ColorProvider(Color.Black)
public val defaultTextStyle: TextStyle = TextStyle(color = defaultTextColor)
}
bbade_
05/20/2025, 9:27 PMColor.unspecified
. Normal compose however has a concept of LocalContentColor
that takes over when the color is unspecified, which Glance currently does not have.