solara
solara copied to clipboard
correct way to propagate theme for embeds
With solara 1.28.0 and either jdaviz 3.8.2 or main
, the theme of jdaviz doesn't render fully when the app is sub-mounted in fastapi versus when run by solara server directly. I believe jdaviz uses voila for theming under the hood. What's the correct way to propagate the theme into Jdaviz?
With solara run --theme-variant="dark" jdaviz_embed.py
, everything looks correct. Both light/dark themes render ok.
When sub-mounted into a FastAPI app, uvicorn test:app --port 9000 --reload
, parts of Jdaviz do not render correctly in either dark/light mode.
import os
from fastapi import FastAPI
os.environ['SOLARA_ROOT_PATH'] = '/solara'
os.environ['SOLARA_APP'] = 'sdss_solara.pages.jdaviz_embed'
os.environ['SOLARA_THEME_VARIANT'] = 'dark'
import solara.server.fastapi as solara_server
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
app.mount("/solara/", app=solara_server.app)