【问题标题】:How can i change the logo of Swagger in my webApi如何在我的 webApi 中更改 Swagger 的徽标
【发布时间】:2017-08-23 14:49:42
【问题描述】:

我正在使用 Swashbuckle 添加我的 WebAPI 2 的文档,我需要更改 Swagger 的徽标和标题的颜色,但我不知道该怎么做.. 任何帮助将不胜感激!

【问题讨论】:

标签: c# swagger-ui


【解决方案1】:

您可以使用 css 更改徽标和标题颜色: 在你的招摇的第三个应用程序中找到 style.css 或主 css 文件,例如在 drf-yasg 你可以细化 drf 根路径 style.css 文件将这些行添加到 css:

/* Custom CSS  */

.topbar-wrapper img {
    content: url(http://127.0.0.1:8000/static/company/logo.png);
}

.swagger-ui .topbar .download-url-wrapper .download-url-button {
    background-color: #red !important;
}

.swagger-ui .topbar .download-url-wrapper input[type=text] {
    border-color: #red !important;
}

【讨论】:

    猜你喜欢
    • 2021-06-16
    • 2021-12-15
    • 2015-11-23
    • 1970-01-01
    • 1970-01-01
    • 2014-07-31
    • 1970-01-01
    • 1970-01-01
    • 2019-11-20
    相关资源
    最近更新 更多