Skip to main content

A package for customizing themes in Streamlit apps.

Project description

Streamlit-Themes

The streamlit-themes package provides a streamlined way to customize the visual appearance of Streamlit applications.

Note: This package accesses the internal config at st._config, and is likely to break with future Streamlit updates. Use with caution. Also, updating the theme with streamlit-themes updates the theme for the entire Streamlit app (including all users), so it's not suitable for multi-user apps.

Installation

To install the streamlit-themes package, simply use pip:

pip install streamlit-themes

Demo

Alt Text

Basic Usage

Here's a basic example of how to use the streamlit-themes package:

import streamlit_themes as st_theme

# Set a custom theme
st_theme.set_theme(
    background_color='#FFFFFF',
    primary_color='#1A73E8',
    secondary_background_color='#F1F3F4',
    text_color='#202124',
    font='sans serif'
)

Functions

The following functions are available directly through the __init__.py file:

  • get_theme: retrieves the current theme settings.
  • set_theme: Sets the theme with given parameters.
  • get_preset_theme: Retrieves a preset theme.
  • set_preset_theme: Sets a preset theme.
  • get_all_preset_themes: Retrieves all preset themes.
  • custom_theme_widget: Creates a custom theme widget for user interaction.
  • preset_theme_widget: Creates a preset theme widget for user interaction.
  • Theme: Dataclass for storing themes.

Here are the preset theme keys available in the constants.py file:

Preset Themes

The streamlit-themes package provides a set of preset keys that can be used to quickly apply predefined themes.

Available Preset Keys

  • Beach
  • Pineapple
  • Peachy
  • Tropical
  • Mater
  • Gastly
  • Ocean
  • Abyssal
  • Green
  • Sandy
  • Sunset
  • Midnight

Example Usage

import streamlit_themes as st_theme

# Directly apply a preset theme
st_theme.set_preset_theme('Beach')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_themes-0.1.0.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

streamlit_themes-0.1.0-py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page