# compose

Chris Johnson

11/15/2023, 11:27 PM
Hello 👋 Just checking because I haven't seen any new information in a while but for our themes to be respected in compose previews we will need to wrap all of our previews in our compose theme, right? Or is there a better way now?


11/15/2023, 11:47 PM
That's still the case currently. Maybe in the future there could be some kind of way to define a wrapper composable for all previews like @PreviewWrapper


11/16/2023, 8:41 AM
I’ve opened a issue some time ago to give us devs some api to create our own previews, which in case it happens, you could make a wrapper for the theme. Give a +1 if you can 🙂

Chris Johnson

11/16/2023, 7:14 PM
Thanks for the replies. Hopefully we get something soon 🙂 We have a lot of previews 😅

Stylianos Gakis

11/17/2023, 11:10 AM
Copy code
<template name="prev" value="
private fun Preview$NAME$() { {
    androidx.compose.material3.Surface(color = androidx.compose.material3.MaterialTheme.colorScheme.background) {
}" description="Create @Preview composable function" toReformat="true" toShortenFQNames="true">
  <variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
  <context />
Take this live template and copy it. Go over to your IDE at
Preferences | Editor | Live Templates
, then go to AndroidComposePreview and right click and paste in there. Replace the HedvigTheme with your own theme and
with your own preview and you’re done. HedvigPreview is this but I think in the latest alphas at least the compose libraries provide dark/light mode preview by default in the library itself, so you don’t need your own.
😲 1

Chris Johnson

11/20/2023, 6:54 PM
Thanks! We also have templates for previews but don't have the theme in there so I'll add that 👍 . Still wishing for some sort of annotation or place we could define and all previews would inherit from