Since accompanist deprecated the `SystemUiControll...
# compose
s
Since accompanist deprecated the
SystemUiController
and promotes
enableEdgeToEdge()
, how do I set the color for the Statusbar icons?
enableEdgeToEdge
only seems to change the background color
f
Copy code
window.statusBarColor = android.graphics.Color.BLACK
WindowCompat.getInsetsController(window, window.decorView).isAppearanceLightStatusBars = true
s
I have this
Copy code
enableEdgeToEdge(
    SystemBarStyle.auto(scrimLight.toArgb(), scrimDark.toArgb()),
    SystemBarStyle.auto(scrimLight.toArgb(), scrimDark.toArgb())
)
but adding the WindowCompat stuff works, thank you
l
If you have
auto
that will use the system setting for dark theme to determine light / dark icons. If for example you are always using a dark theme, you should use
SystemBarStyle.dark(Color.TRANSPARENT)
or similar instead
That will internally do the WindowCompat stuff linked above for you, based on this input
s
darkmode was fine but for lightmode it still displayed white icons, with the
auto
settings I showed above
l
Is your light / dark mode controlled by the system? Or do you have a user specified flag for example?
s
ah I do have a user controlled setting in my app
l
Then you should set the parameter inside
auto
,
Copy code
detectDarkMode: (Resources) -> Boolean = { resources ->
                (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) ==
                    Configuration.UI_MODE_NIGHT_YES
            }
And pass a lambda here that queries your user controlled setting too
Basically this lambda is responsible for determining light / dark for the icons as well
s
oh I see
l
It might be good to file a bug and ask for improved documentation if you feel that it is confusing here