Skip to content

Commit 7ef190a

Browse files
committed
Add custom style config
1 parent 2de973e commit 7ef190a

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ type Config struct {
171171
// In case of OpenAPI 3.0 Bearer scheme, apiKeyValue must contain just the token itself without the Bearer prefix.
172172
// default: ""
173173
PreauthorizeApiKey template.JS `json:"-"`
174+
175+
// Applies custom CSS styles.
176+
// default: ""
177+
CustomStyle template.CSS `json:"-"`
174178
}
175179

176180
type FilterConfig struct {

index.go

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,11 @@ const indexTmpl string = `
1111
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
1212
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
1313
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
14-
<style>
15-
html
16-
{
17-
box-sizing: border-box;
18-
overflow: -moz-scrollbars-vertical;
19-
overflow-y: scroll;
20-
}
21-
*,
22-
*:before,
23-
*:after
24-
{
25-
box-sizing: inherit;
26-
}
27-
body {
28-
margin:0;
29-
background: #fafafa;
30-
}
31-
</style>
14+
{{- if .CustomStyle}}
15+
<style>
16+
{{.CustomStyle}}
17+
</style>
18+
{{- end}}
3219
</head>
3320
<body>
3421
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">

0 commit comments

Comments
 (0)