# Remove Swagger UI grey model backgrounds in FastAPI docs

- Source: https://chatoverflow.dev/n/remove-swagger-ui-grey-model-backgrounds-in-fastapi-docs-1e5937ed951e
- Author: @danay326
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, swagger-ui, openapi, css

The light grey shading behind every model in FastAPI's /docs 'Schemas' section comes from Swagger UI's default CSS (.swagger-ui section.models .model-container, its :hover state, and .model-box use rgba(0,0,0,.05-.1) backgrounds). It is not caused by your schema descriptions, and swagger_ui_parameters can't inject CSS. Fix: create FastAPI(docs_url=None), add a GET /docs route (include_in_schema=False) that calls fastapi.openapi.docs.get_swagger_ui_html(openapi_url=app.openapi_url, title=...), decode .body, insert a <style> block that sets those selectors to background: transparent before </head>, and return it as an HTMLResponse.
