Skip to main content

shinyswatch

Bootswatch + Bootstrap 5 themes for Shiny.

Here are just three of the 25 themes in shinyswatch:

Minty Sketchy Superhero
Minty Sketchy Superhero

Installation

pip install shinyswatch

To install the latest development version from this repository:

pip install https://github.com/rstudio/py-shinyswatch/tarball/main

Usage

To use a theme, add a shinyswatch.theme theme object to your App’s UI definition.

# Minty theme
shinyswatch.theme.minty

# Sketchy theme
shinyswatch.theme.sketchy

# Superhero theme
shinyswatch.theme.superhero

Example Shiny application:

File: app.py

Screenshot

from shiny import App, Inputs, Outputs, Session, render, ui

import shinyswatch

app_ui = ui.page_fluid(
    ui.input_slider("num", "Number:", min=10, max=100, value=30),
    ui.output_text_verbatim("slider_val"),
    theme=shinyswatch.theme.darkly,  # <- Use a shinyswatch theme here
)


def server(input: Inputs, output: Outputs, session: Session):
    @output
    @render.text
    def slider_val():
        return f"{input.num()}"


app = App(app_ui, server)

darkly theme

Note: When writing shiny apps that use shinyswatch on shinylive.io, remember to add shinyswatch to your requirements.txt file!

Theme picker

To add a theme picker to your app, add the theme picker UI and server functions to your app’s UI and server definitions.

Demo theme picker app on shinylive.io.

Plot Theming

shinyswatch themes include a .colors attribute that can be used to theme plots or other outputs and UI elements. In the example below, try changing the theme and re-running the app to see how the plot changes.

Demo plot theming app on shinylive.io.

Development

If you want to do development on shinyswatch for Python:

pip install -e ".[dev,test,docs]"

Examples

There are multiple examples in the shinyswatch repo.

To run the demos locally, you can run the examples by calling:

python3 -m shiny run examples/basic-darkly/app.py
python3 -m shiny run examples/big-sketchy/app.py
python3 -m shiny run examples/components/app.py
python3 -m shiny run examples/theme-picker/app.py

Metadata

Release files for shinyswatch 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shinyswatch 0.14.0
File Size Uploaded Provenance Actions
shinyswatch-0.14.0.tar.gz 1.4 MB Without provenance Details for shinyswatch-0.14.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shinyswatch 0.14.0
File Interpreter ABI Platform Actions
shinyswatch-0.14.0-py3-none-any.whl Python 3 none any Details for shinyswatch-0.14.0-py3-none-any.whl

Total release size: 2.9 MB

Release files / shinyswatch-0.14.0.tar.gz

Download URL shinyswatch-0.14.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
3ca13b0c6e2eef5e7ed62a39332f86951e12b28ed47c8d5d23c0d09d0581dead
BLAKE2b-256 checksum
How to use checksums
0ed1902923245f75f20ed727765ba162f32dad65d5533d03b17fbc3a4462eaf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / shinyswatch-0.14.0-py3-none-any.whl

Download URL shinyswatch-0.14.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
43eb1c6ade7385daaff6aff26cf94bd658efb68238d4304f1107fc2960ffd935
BLAKE2b-256 checksum
How to use checksums
05a1ab3f544b80ed984965bc152f5016058f44f2ec110c22e0fbaf059196232a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for shinyswatch 0.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page