Theme Change via URL

I’m trying to figure out how to automatically switch between themes by modifying the JupyterLab URL. Something like this to switch would be ideal:
‘…/lab?theme=light’ or ‘…/lab?theme=dark’

Otherwise is it possible to write an extension to manage this? I don’t think I can use workspaces since when changing workspaces all UI elements change, I’m interested in keeping the same notebook.

Hi @berkser, there is currently no way to do this in stock JupyterLab, but you can definitely write an extension that does this. You can request the IRouter token, register a handler that looks for a theme parameter, and change the theme in response to it.

An example of an extension that looks for a query parameter is here. You would instead write a command that changes the theme.

2 Likes