-
Notifications
You must be signed in to change notification settings - Fork 261
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
feat: marimo.app_meta.theme and custom themers to auto switch plotting themes based on the display theme #2126
Conversation
for more information, see https://pre-commit.ci
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@metaboulie, this should fix the bokeh background: #2128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa, this is cool, nice work @metaboulie!
I have just a comment on the public API. I noticed AppMeta
was added to __init__.py
. Instead, I would suggest having each library's theming function run when its formatter is registered (e.g., for altair, here: https://github.com/marimo-team/marimo/blob/main/marimo/_output/formatters/altair_formatters.py#L17, and similarly for the other libraries).
That way we wouldn't need to add anything to the public API (but could later if we needed to), and theming application would be lazy (performant) and automatic.
(cc @mscolnick)
marimo/_runtime/app_meta.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the right file to put AppMeta?
for more information, see https://pre-commit.ci
nice job @metaboulie! this is awesome |
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.8.5-dev3 |
📝 Summary
This pull request introduces a new mechanism for managing and applying themes across different plotting libraries used within Marimo notebooks.
Changes Made
AppMeta
class is introduced to store application metadata like the current display theme (light
ordark
).app_meta()
function: Added a function to retrieve the current application metadata.register_formatters
function now accepts a theme parameter to pass the current theme to formatters at runtime.Problem Addressed
Previously, customizing the theme of visualizations required manual adjustments within each plotting library. This pull request simplifies theme management and ensures consistent theme application across all charts.
Resolution
By introducing a centralized theme management system, this PR allows for seamless theme application across various plotting libraries, enhancing the user experience and visual consistency within Marimo notebooks.
📋 Checklist
📜 Reviewers
@akshayka OR @mscolnick