marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.

Home Page:https://marimo.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

marimo.app_meta.theme

metaboulie opened this issue · comments

Description

Add a marimo.settings, to control or only read the settings if controlling setting in cell will interrupt the notebook.

Suggested solution

Why this feature can be useful:
We can use the value of marimo.settings.width, marimo.setting.theme, etc to render some ui.
for instance, plotly, when specifying a figure's layout, we can do the following:

template = 'plotly_dark` if marimo.settings.theme == 'dark' else 'plotly_white'
fig.update_layout(
    template=template
)

then we can get a dark plotly figure in dark mode and a light one in light mode

Alternative

No response

Additional context

No response

We should expose the theme for sure - not sure if we need all the other settings.

We can put this in AppMetadata.

Also - it would be nice if marimo could handle these setting under the hood (but can be turned off).

e.g.
marimo.theme.autohandle_third_party()

@metaboulie - i updated the title to add marimo.app_meta.theme. We can think about adding more settings there over time for specific use-cases

For the implementor:
We have something already called AppMetadata. That is currently an internal class that we probably don't want to expose everything in there. So we can rename that, or come up with another name for what marimo.app_meta is