Thread
#compose
    Rick Regan

    Rick Regan

    10 months ago
    I'm trying to (properly) implement Material Theming in my app so that it can support light and dark themes. One screen of my app requires additional colors beyond the Material primary, secondary, etc. I was looking at the Rally sample app as a model because it uses extra colors to color code the account types. However, it uses Colors, which appears to go against the advice to use
    MaterialTheme.colors
    instead. What is the recommended way to declare additional colors that are sensitive to theme changes? (References in 🧵.)

    References:

    https://material.io/design/color/the-color-system.html#color-theme-creation : On Rally app: "Additional colors for data visualization. Apps can use additional colors to convey categories that are outside of your main color theme. They are still a part of your full color palette." - https://material.io/blog/material-theme-builder : "We strongly recommend referencing the Colors provided to the
    MaterialTheme
    composable via
    MaterialTheme.colors
    and not the values defined in
    Colors.kt
    in your UI. This will allow you to accept dynamic colors and easily switch between light and dark themes."
    a

    annsofi

    10 months ago
    Rick Regan

    Rick Regan

    10 months ago
    Ok, thanks, I guess there's only a "roll your own" solution then. I'll read up on it.
    l

    Louis Pullen-Freilich [G]

    10 months ago
    Rick Regan

    Rick Regan

    10 months ago
    That looks like a cleaner way to do it -- thanks.
    Colton Idle

    Colton Idle

    10 months ago
    I feel like Nick Butcher talked about themeOverlays in compose a few months ago here on slack.