Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itz-fork/fastapi-swagger-ui-dark
Dark theme for Swagger UI (Fastapi)
https://github.com/itz-fork/fastapi-swagger-ui-dark
fastapi swagger swagger-ui-dist swagger-ui-themes
Last synced: about 1 month ago
JSON representation
Dark theme for Swagger UI (Fastapi)
- Host: GitHub
- URL: https://github.com/itz-fork/fastapi-swagger-ui-dark
- Owner: Itz-fork
- License: wtfpl
- Created: 2022-06-16T16:12:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-25T17:29:25.000Z (over 2 years ago)
- Last Synced: 2023-03-05T14:43:49.353Z (almost 2 years ago)
- Topics: fastapi, swagger, swagger-ui-dist, swagger-ui-themes
- Language: CSS
- Homepage:
- Size: 124 KB
- Stars: 6
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fastapi Swagger UI Dark
Dark theme for Swagger UI used in Fastapi applications ([swagger-ui-dist](https://cdn.jsdelivr.net/npm/swagger-ui-dist@4/swagger-ui.css)) based on [catppuccin color theme](https://github.com/catppuccin/catppuccin)## Usage
You can pass the cdn link to `swagger_css_url` parameter in `get_swagger_ui_html` function in Fastapi> There are 2 css files,
> - [swagger_ui_dark.css](assets/swagger_ui_dark.css) - Main css file
> - [swagger_ui_dark.min.css](assets/swagger_ui_dark.min.css) - Minified version of the 1st one- **With CDN (jsdelivr)**
- CDN url:
```
https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css
```
- Example:
```python
@app.get("/docs", include_in_schema=False)
async def custom_swagger_ui_html_cdn():
return get_swagger_ui_html(
openapi_url=app.openapi_url,
title=f"{app.title} - Swagger UI",
# swagger_ui_dark.css CDN link
swagger_css_url="https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css"
)
```
- **With Github**
- Raw url:
```
https://raw.githubusercontent.com/Itz-fork/Fastapi-Swagger-UI-Dark/main/assets/swagger_ui_dark.min.css
```
- Example:
```python
@app.get("/docs", include_in_schema=False)
async def custom_swagger_ui_html_github():
return get_swagger_ui_html(
openapi_url=app.openapi_url,
title=f"{app.title} - Swagger UI",
# swagger_ui_dark.css raw url
swagger_css_url="https://raw.githubusercontent.com/Itz-fork/Fastapi-Swagger-UI-Dark/main/assets/swagger_ui_dark.min.css"
)
```