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

Adds dark theme and theme switching functionality (REPL + website) #25

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

agriyakhetarpal
Copy link
Collaborator

@agriyakhetarpal agriyakhetarpal commented Jan 15, 2025

Description

This PR adds a dark theme to the overall website. The REPL iframe can switch themes without having to restart the kernel, which requires a theme bridge as described in https://jupyterlite.readthedocs.io/en/stable/howto/configure/advanced/iframe.html

Tip

This PR is a work-in-progress and is not yet ready for review. However, initial feedback is welcome. The description below is a stub.

An initial look is looking good, so far:

Screen.Recording.2025-01-16.at.2.43.37.AM.mov

Closes sympy/sympy.github.com#199

TODO items

  • Get the theme switch toggle button placed in a proper position
    • Increase sizing for button text
    • Decide position: whether to add to the top navbar or to the top right of the REPL section
    • Decide whether to use FontAwesome icons (PyData Sphinx Theme) v.s. sticking with ☀️🌗🌙 emoji
  • Move the theme bridge switch to a separate repository and package it, perhaps?
    • Contribute to the JupyterLite docs upstream to respect prefers-color-scheme patch
    • Ask JupyterLite developers what the best solution would be for this
  • Conduct an accessibility audit for dark mode support
    • Resolve known issues
      • SymPy text for <768px in dark green header should be white and not light green
      • Check if mobile theming works
  • Add instructions for the dark theme bridge in the README

@jtpio
Copy link
Contributor

jtpio commented Jan 17, 2025

This looks great, thanks @agriyakhetarpal!

Move the theme bridge switch to a separate repository and package it, perhaps?

For reference there is now an extension to provide that kind of bridge between a host page and a JupyterLab / JupyterLite instance running in the IFrame: https://github.com/TileDB-Inc/jupyter-iframe-commands.

So it could be interesting to try to use that extension here, and see if it helps simplify the diff and not have to add a new extension. That would mean:

  • installing the jupyter-iframe-commands extension in the JupyterLite environment
  • using the jupyter-iframe-commands-host package to send the command for switching theme

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

Successfully merging this pull request may close these issues.

Light and dark mode
2 participants