Metadata-Version: 2.4
Name: swagger-theme-toggle
Version: 0.1.1
Summary: Light / dark / system theme toggle for FastAPI's Swagger UI docs page
Keywords: fastapi,swagger,swagger-ui,openapi,dark-mode,theme
Author: Roy Megidish
Author-email: Roy Megidish <roy.megidish@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Framework :: FastAPI
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: fastapi>=0.139.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# swagger-theme-toggle

Adds a Light / Dark / Auto theme toggle to FastAPI's Swagger UI docs page.

## Install

```bash
pip install swagger-theme-toggle
# or
uv add swagger-theme-toggle
```

## Usage

```python
from fastapi import FastAPI
from swagger_theme_toggle import add_dark_mode_toggle

app = FastAPI()

# ... register your routes ...

add_dark_mode_toggle(app)
```

Call `add_dark_mode_toggle` last, after your routes and app settings (title,
`openapi_url`) are finalized — it snapshots them to build the replacement
`/docs` route.

### Options

```python
add_dark_mode_toggle(
    app,
    docs_url="/docs",       # where to mount the docs page
    default_theme="system", # "light" | "dark" | "system"
)
```

The chosen theme is persisted in the browser's `localStorage`, so it survives
reloads. "system" follows the OS `prefers-color-scheme`.

## Development

```bash
uv sync
uv run pytest
```
