Set theme dynamically on landing

Hi, I’m an experienced dev but totallly new to Discourse, will be using on a project and currently planning on light/dark user themes.

The forum will be a subdomain of another app, where the user will be able to toggle dark mode. My question is, does Discourse provide a way for us to pass the current user theme when they access the forum, for a seamless experience?

If so, is there a common mechanism for communicating back to the parent site if the user changes the theme within the forum?

Hoping this is a problem that’s been solved before, and doesn’t require custom functionality. Thanks!

Are you using sso? You might pass a group for the dark theme and then use that group to modify the theme component.

1 Like

Yes, that’s a thought, maybe we could re-authenticate and pass user prefs that get packed into the jwt.

Assuming we can get that information to the forum through that or a query parameter, what would be the normal way to consume that information and set the user theme prior to the initial render?