Hey guys, I am trying to provide a `ColorPalette` ...
# compose
f
Hey guys, I am trying to provide a
ColorPalette
appwide like that:
Copy code
object AppColors {
    private val primaryColor: Color = Color(0x464763)

    val lightPalette: ColorPalette = lightColorPalette(
        primary = primaryColor
    )

    val darkPalette: ColorPalette = darkColorPalette(
        primary = primaryColor
    )

    @Composable
    val currentPalette: ColorPalette
        get() = if (isSystemInDarkTheme()) darkPalette else lightPalette
}
When I use it for my
MaterialTheme(colors = AppColors.currentPalette) { … }
, the primary color is just invisible or set to transparent, what am I doing wrong? If I dont overwrite the primary, then everything works as expected (images in thread).
with custom
primary
without custom
primary
a
can you try to write
Color(0xFF464763)
f
oof 🤦 thanks
a
it is too easy to make this mistake, we should do it automatically in some way. can you please file a bug so we we will not forget to make it easier? thanks!
g
Are you still having this issue? I noticed we can't pass a @Composable ColorPalette or a @Composable Typography to
MaterialTheme
@flosch
f
No it worked after I corrected the hex
👌🏻 1
c
FWIW the new color picker in Studio can also help in the future on the line
Color
is used via the gutter icon. Also very useful for converting alpha % to hex.
g
Just an update, what I said before is not actually an issue. The problem is having a backing field for the @Composable ColorPalette, not the fact that it's @Composable https://issuetracker.google.com/issues/154531805