Slackbot
11/11/2024, 9:36 AMStylianos Gakis
11/11/2024, 2:42 PMStylianos Gakis
11/11/2024, 2:50 PMStylianos Gakis
11/11/2024, 3:03 PMobject AppTheme {
/**
* Retrieves the current [ColorScheme] at the call site's position in the hierarchy.
*/
val colorScheme: ColorScheme
@Composable
@ReadOnlyComposable
get() = LocalColorScheme.current
}
For that screen, you need to have called
CategoryTheme {
ThatScreen()
}
Where CategoryTheme
should do
CompositionLocalProvider(LocalColorScheme provides categoryColorScheme) {
content()
}
where categoryColorScheme
should be the ColorScheme
for that other theme of yoursStylianos Gakis
11/11/2024, 3:12 PMfun WhateverComposable() {
Something()
CategoryTheme {
SomethingWithCategoryTheme
}
SomethingElse()
}
Even though I must admit it looks fishy to have mixed themes used like that not only within one screen, but within even one component.Stylianos Gakis
11/11/2024, 3:23 PMCategoryTheme
exactly in your case? Is it the entire theme object that contains typography, colorschemes, shapes etc?Stylianos Gakis
11/11/2024, 4:55 PMCetegoryTheme {}
and inside the object itself you can still use AppTheme.colorScheme.primary, and it will then grab the right one that was provided by your composition local override.
That's how I interpret this tbh.
I think jetcaster https://github.com/android/compose-samples/tree/main/Jetcaster does something similar with having the same theme but with overridden colors in some contexts