whitphx/stlite

Feature Request: support some streamlit configuration (at least Theming)

Abdelgha-4 opened this issue · 3 comments

Hello,

Streamlit apps may have a config.toml that offers many options for customization and finer control over the app. I think that supporting at least some of the options would be a convenient and useful feature.

For example this is the configuration I was using on a Streamlit app, but when moving to stlite I found no way to apply the same config.

[theme]
primaryColor ="#E51E2B"
secondaryBackgroundColor = "#F5F5F5"

[client]
toolbarMode = "minimal"
showErrorDetails = false

[runner]
magicEnabled = false
fastReruns = true
enforceSerializableSessionState = true

If you are using @stlite/mountable, the streamlitConfig option of stlite.mount() is for that purpose as below.
You can pass the key-value pairs of the configs.
Unlike config.toml, the keys are not nested, but period-separated values like theme.primaryColor.

stlite.mount(
  {
    // Other options...
    streamlitConfig: {
        "theme.primaryColor": "#E51E2B",
        "theme.backgroundColor": "#FFFFFF",
        "theme.secondaryBackgroundColor": "#262730",
        "theme.textColor": "#fafafa",
        "theme.font": "sans serif",
    },
  },
  document.getElementById("app")
);

In stlite sharing or @stlite/desktop, this feature is not available yet.

Thanks! That's exactly what I wanted. I didn't find any reference or documentation about streamlitConfig.
Please feel free to close the issue if it's documented.

Sorry I hadn't documented it yet, and did in #1010 . Will close this issue when it's merged.