system.perspective.setTheme('dark') not working on Session Events - Startup

Hello there,

I’m just trying to set the default theme for when a user logs into the project as ‘dark’, sometimes I find these session event scripts to not work for some reason, and this one is not working. What am I doing wrong?

Are there any errors in the logs?
Also, you could just directly manipulate the session property for the theme to ‘dark’ to set the default.

Session theme dark

Just set the session.props.theme to dark and that becomes the default. No need for a script.

The system.perspective.setTheme manual page says,

Note that this function only changes the theme for a single page, not the entire session. To change the theme for a session, write directly to the session.theme property instead.


Transistor mentioned that the scope of that script is limited to pages, which would explain why that doesn’t work for session scripts. Thanks for pointing out where to properly set it.