# compose

Vitor Prado

01/20/2021, 3:36 PM
which theme should be used in manifest? I need to create a light and a dark theme in xml too? or compose has a default for that?

Oussama Haff.

01/20/2021, 3:42 PM
There is no need to declare anything in the manifest. Please take a look at this sample app from Google to see how dark/light theme is set in Compose

Vitor Prado

01/20/2021, 3:44 PM
@Oussama Haff. thanks for the reference.. but looking into the manifest file, there is a declaration of themes and colors for light/dark themes:

Oussama Haff.

01/20/2021, 4:00 PM
AFAIK, the declaration in the manifest is needed because the Activity still need to use Theme.AppCompat for Android (or you get a runtime exception). whereas Compose Theme applies the theme on the content inside of the activity on the descendants of
setContent { }
function / This is my personal interpretation of things /

Adam Powell

01/20/2021, 4:02 PM
nah, you don't have to use Theme.AppCompat. You could just as easily use the on-device android:Theme.Material. The only thing you have to use a static theme for is for the, "starting window" that Android displays before your activity code starts running.
👍 1
so you could imagine why you might want to make that light/dark aware; you wouldn't want someone using the app in dark mode to get a sudden bright flash on their screen when your app first loads.
(You can write an entire compose app without including the appcompat library at all)
👍 2


01/20/2021, 4:59 PM
Preview annotation uses the manifest theme?


01/20/2021, 10:58 PM
Here's an example commit which switched one of our samples from AppCompat to a platform material theme, notice how it inherits from light/dark parents:
🙌 2