# shinyswatch
[Bootswatch](https://bootswatch.com/) + Bootstrap 5 themes for [Shiny](https://shiny.rstudio.com/py/).
Here are just three of the **25 themes** in shinyswatch:
| Minty | Sketchy | Superhero |
|----------------------------|--------------------------------|------------------------------------|
| ![Minty](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_minty.png) | ![Sketchy](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_sketchy.png) | ![Superhero](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_superhero.png) |
## Installation
```sh
pip install shinyswatch
```
To install the latest development version from this repository:
```sh
pip install https://github.com/rstudio/py-shinyswatch/tarball/main
```
## Usage
To use a theme, call the theme function and add it to your App's UI definition.
```python
# Minty theme
shinyswatch.theme.minty
# Sketchy theme
shinyswatch.theme.sketchy
# Superhero theme
shinyswatch.theme.superhero
```
Example Shiny application:
<table>
<thead><tr>
<th>File: <code>app.py</code></th>
<th>Screenshot</th>
</tr></thead>
<tbody><tr><td>
```python
from shiny import App, Inputs, Outputs, Session, render, ui
import shinyswatch
app_ui = ui.page_fluid(
# Theme code - start
shinyswatch.theme.darkly,
# Theme code - end
ui.input_slider("num", "Number:", min=10, max=100, value=30),
ui.output_text_verbatim("slider_val"),
)
def server(input: Inputs, output: Outputs, session: Session):
@output
@render.text
def slider_val():
return f"{input.num()}"
app = App(app_ui, server)
```
</td><td>
![darkly theme](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_darkly.png)
</td></tr></tbody></table>
> Note: When writing shiny apps on [shinylive.io](https://shinylive.io/py/editor/#code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6lACZw6EgK4cAOhD4ChrTtxYB3KGUJtVqtKgD6SpgF4mSrFADmcczQA2S6QApVTP1q5sPQMjDDI2OHgMAC84VDZseV9-ey5UBTJzFjcOWTofSGV8JiKAOSKJAAYJAEZK6qYAJkqASjxkv3tiDPTMigAPTIA3OQAjAz4CskGittUWkwhVWRpWORH8tIyJbrJeiRY4FhYOUhbEDqYAAV3ey6upCDywuBmIfyYVpmmyL3PLj5SMgKOjvGhFCAAKkavBYTBAWzIGAgfyYkKaAF8iotTOgbKJ0F4zJYOAd1nIFhAwBi8OBoPBqFIAI5KKTwcgsMKDfBEUgUKjIdiBYKGNjUgC6QA), remember to add `shinyswatch` to your `requirements.txt` file!
### Theme picker
To add a theme picker to your app, add the `shinyswatch.theme_picker_ui()` in place of your theme object and add `shinyswatch.theme_picker_server()` into your `server` definition.
Demo: [shinylive.io](https://shinylive.io/py/editor/#code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxMAkhFQBXMiwkB5eXIUSAynBYsOpCXUoATOHQmyOAHQjW+Aoa07cWAdyhlCba9bSoA+hZMALxMFlhQAOZwfjQANhZGABTWTKlMAMRMACpscPBMqByEANamTAC0rGRQQilp7FzYru6eGGS58H6FJaYBHIkAlHh1qZk5eXAFRaV0FUzGI6EcGFxqfiyxHCZ0yZCyMJb4TIcAcvsARqaIhxIwXEEAjAAMt1AAHo9PL0wAblDxcCCAGYnkNFmFiKp5H4KG8yH4fqZzu4+LsNlten9YocwRABt4bBATDRWKZETtVvJEFIZPJFExIWQ1NSVEy6RIWNpdKRqVodHo8dcIGkMmMOpNujM5ixqrVhfUnE03B42G1xV1pr1OXRyYNFukxRMpj1ZpUFoSRQABRlqRaWwxE0xtOBwxbE1ibbYI-6DIUikWGMiyOjCmiHECUsgYCD7QYAX0OBJ86GConQiV8fQ5ZNM+MJYDjeHA0Hg1EMAEcLIZ4OQWG04fgiKQKFRkA1nMrPAWALpAA)
## Development
If you want to do development on shinyswatch for Python:
```sh
pip install -e ".[dev,test,docs]"
```
### Examples
There are multiple examples in the shinyswatch repo.
<!-- You can view them online at: [shinyswatch.theme.darkly](http://rstudio.github.io/py-shinyswatch/reference/theme.darkly.html) and [get_theme](http://rstudio.github.io/py-shinyswatch/reference/get_theme.html). -->
To run the demos locally, you can run the examples by calling:
```sh
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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/rstudio/py-shinyswatch",
"name": "shinyswatch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "html",
"author": "Barret Schloerke",
"author_email": "barret@posit.co",
"download_url": "https://files.pythonhosted.org/packages/45/2d/a6e1c1135882b086cbec86c16bbf2f11ad4241c237462759e7246d25197d/shinyswatch-0.6.0.tar.gz",
"platform": "any",
"description": "# shinyswatch\n\n[Bootswatch](https://bootswatch.com/) + Bootstrap 5 themes for [Shiny](https://shiny.rstudio.com/py/).\n\n\nHere are just three of the **25 themes** in shinyswatch:\n\n| Minty | Sketchy | Superhero |\n|----------------------------|--------------------------------|------------------------------------|\n| ![Minty](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_minty.png) | ![Sketchy](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_sketchy.png) | ![Superhero](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_superhero.png) |\n\n\n## Installation\n\n```sh\npip install shinyswatch\n```\n\nTo install the latest development version from this repository:\n\n```sh\npip install https://github.com/rstudio/py-shinyswatch/tarball/main\n```\n\n## Usage\n\nTo use a theme, call the theme function and add it to your App's UI definition.\n\n```python\n# Minty theme\nshinyswatch.theme.minty\n\n# Sketchy theme\nshinyswatch.theme.sketchy\n\n# Superhero theme\nshinyswatch.theme.superhero\n```\n\nExample Shiny application:\n\n<table>\n <thead><tr>\n <th>File: <code>app.py</code></th>\n <th>Screenshot</th>\n </tr></thead>\n <tbody><tr><td>\n\n```python\nfrom shiny import App, Inputs, Outputs, Session, render, ui\n\nimport shinyswatch\n\napp_ui = ui.page_fluid(\n # Theme code - start\n shinyswatch.theme.darkly,\n # Theme code - end\n ui.input_slider(\"num\", \"Number:\", min=10, max=100, value=30),\n ui.output_text_verbatim(\"slider_val\"),\n)\n\n\ndef server(input: Inputs, output: Outputs, session: Session):\n @output\n @render.text\n def slider_val():\n return f\"{input.num()}\"\n\n\napp = App(app_ui, server)\n```\n\n</td><td>\n\n![darkly theme](https://raw.githubusercontent.com/rstudio/py-shinyswatch/v0.2.2/readme_darkly.png)\n\n</td></tr></tbody></table>\n\n> Note: When writing shiny apps on [shinylive.io](https://shinylive.io/py/editor/#code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6lACZw6EgK4cAOhD4ChrTtxYB3KGUJtVqtKgD6SpgF4mSrFADmcczQA2S6QApVTP1q5sPQMjDDI2OHgMAC84VDZseV9-ey5UBTJzFjcOWTofSGV8JiKAOSKJAAYJAEZK6qYAJkqASjxkv3tiDPTMigAPTIA3OQAjAz4CskGittUWkwhVWRpWORH8tIyJbrJeiRY4FhYOUhbEDqYAAV3ey6upCDywuBmIfyYVpmmyL3PLj5SMgKOjvGhFCAAKkavBYTBAWzIGAgfyYkKaAF8iotTOgbKJ0F4zJYOAd1nIFhAwBi8OBoPBqFIAI5KKTwcgsMKDfBEUgUKjIdiBYKGNjUgC6QA), remember to add `shinyswatch` to your `requirements.txt` file!\n\n### Theme picker\n\nTo add a theme picker to your app, add the `shinyswatch.theme_picker_ui()` in place of your theme object and add `shinyswatch.theme_picker_server()` into your `server` definition.\n\nDemo: [shinylive.io](https://shinylive.io/py/editor/#code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxMAkhFQBXMiwkB5eXIUSAynBYsOpCXUoATOHQmyOAHQjW+Aoa07cWAdyhlCba9bSoA+hZMALxMFlhQAOZwfjQANhZGABTWTKlMAMRMACpscPBMqByEANamTAC0rGRQQilp7FzYru6eGGS58H6FJaYBHIkAlHh1qZk5eXAFRaV0FUzGI6EcGFxqfiyxHCZ0yZCyMJb4TIcAcvsARqaIhxIwXEEAjAAMt1AAHo9PL0wAblDxcCCAGYnkNFmFiKp5H4KG8yH4fqZzu4+LsNlten9YocwRABt4bBATDRWKZETtVvJEFIZPJFExIWQ1NSVEy6RIWNpdKRqVodHo8dcIGkMmMOpNujM5ixqrVhfUnE03B42G1xV1pr1OXRyYNFukxRMpj1ZpUFoSRQABRlqRaWwxE0xtOBwxbE1ibbYI-6DIUikWGMiyOjCmiHECUsgYCD7QYAX0OBJ86GConQiV8fQ5ZNM+MJYDjeHA0Hg1EMAEcLIZ4OQWG04fgiKQKFRkA1nMrPAWALpAA)\n\n\n\n## Development\n\nIf you want to do development on shinyswatch for Python:\n\n```sh\npip install -e \".[dev,test,docs]\"\n```\n\n### Examples\n\nThere are multiple examples in the shinyswatch repo.\n\n<!-- You can view them online at: [shinyswatch.theme.darkly](http://rstudio.github.io/py-shinyswatch/reference/theme.darkly.html) and [get_theme](http://rstudio.github.io/py-shinyswatch/reference/get_theme.html). -->\n\nTo run the demos locally, you can run the examples by calling:\n\n```sh\npython3 -m shiny run examples/basic-darkly/app.py\npython3 -m shiny run examples/big-sketchy/app.py\npython3 -m shiny run examples/components/app.py\npython3 -m shiny run examples/theme-picker/app.py\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Bootswatch + Bootstrap 5 themes for Shiny.",
"version": "0.6.0",
"project_urls": {
"Bug Tracker": "https://github.com/rstudio/py-shinyswatch/issues",
"Homepage": "https://github.com/rstudio/py-shinyswatch",
"Source Code": "https://github.com/rstudio/py-shinyswatch"
},
"split_keywords": [
"html"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f022ee61c29ae02dd6f9cb5bd80804ade3d85b9b0c9782c930d8c061fcc863a8",
"md5": "d19d69fac7100a63c15a0a090fbf8574",
"sha256": "8de7153f84d533bc8252bf47674c622351a8cb0ae6b2afaf81f167b7af1b417f"
},
"downloads": -1,
"filename": "shinyswatch-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d19d69fac7100a63c15a0a090fbf8574",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 1101017,
"upload_time": "2024-04-16T15:28:55",
"upload_time_iso_8601": "2024-04-16T15:28:55.021596Z",
"url": "https://files.pythonhosted.org/packages/f0/22/ee61c29ae02dd6f9cb5bd80804ade3d85b9b0c9782c930d8c061fcc863a8/shinyswatch-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "452da6e1c1135882b086cbec86c16bbf2f11ad4241c237462759e7246d25197d",
"md5": "d78f1ac55ffce408a99c2f33d51a4ef3",
"sha256": "2e8aae04f800da4197c8251c97051fb38e6edc4bd2b7a47330ab339a64ca53c5"
},
"downloads": -1,
"filename": "shinyswatch-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "d78f1ac55ffce408a99c2f33d51a4ef3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 1082399,
"upload_time": "2024-04-16T15:28:57",
"upload_time_iso_8601": "2024-04-16T15:28:57.590427Z",
"url": "https://files.pythonhosted.org/packages/45/2d/a6e1c1135882b086cbec86c16bbf2f11ad4241c237462759e7246d25197d/shinyswatch-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-16 15:28:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rstudio",
"github_project": "py-shinyswatch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "shinyswatch"
}