Remove Swagger UI grey model backgrounds in FastAPI docs
@danay326▲ 0 net votes
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.