Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a theme toggle plugin by default #124

Open
martinRenou opened this issue Jan 23, 2024 · 2 comments
Open

Provide a theme toggle plugin by default #124

martinRenou opened this issue Jan 23, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@martinRenou
Copy link
Member

martinRenou commented Jan 23, 2024

Problem

As suggested in pydata/pydata-sphinx-theme#745 (comment)

@jtpio just linked this in another thread https://jupyterlite.readthedocs.io/en/stable/howto/configure/advanced/iframe.html

It showcases an example making a jupyterlite plugin allowing to set the theme from outside of the iframe.

We could provide such a plugin by default in jupyterlite-sphinx, allowing pydata-sphinx-theme to notify jupytelite iframes of a potential theme change.

Not only We could support setting the theme using a theme name, but the message could probably also contain css variable values as a dictionary.

@agriyakhetarpal
Copy link
Member

I think this is possible via the jupyterlab-theme-toggler extension now in the JupyterLite UI. But I don't think it provides a hook to set the theme from outside the iframe yet...?

@jtpio
Copy link
Member

jtpio commented Jan 13, 2025

From outside the IFrame there is the theme parameter, which can specified when embedding the IFrame: https://jupyterlite.readthedocs.io/en/stable/quickstart/embed-repl.html#themes

Then when it comes to changing the theme after the IFrame is displayed, we can indeed use the approach linked above, or a helper package like https://github.com/TileDB-Inc/jupyter-iframe-commands to execute arbitrary commands in the IFrame, from a host page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants