Skip to content

Commit faf8557

Browse files
authored
Add dark mode to API Docs (#24971)
Add a dark mode to Swagger UI via CSS `invert`. No toggle or anything, but I think it's better than nothing. Users can toggle via their OS. Also includes a few misc CSS cleanups on the page. <img width="1264" alt="Screenshot 2023-05-28 at 20 25 06" src="https://github.com/go-gitea/gitea/assets/115237/de761b85-ca0c-4220-bee4-73798a4360a0"> <img width="1260" alt="Screenshot 2023-05-28 at 20 02 54" src="https://github.com/go-gitea/gitea/assets/115237/29188ed2-c167-47f5-bf28-46193d1da22c">
1 parent acb13af commit faf8557

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

web_src/css/standalone/swagger.css

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
html {
2-
box-sizing: border-box;
3-
overflow-y: scroll;
4-
}
5-
61
*,
72
*::before,
83
*::after {
9-
box-sizing: inherit;
4+
box-sizing: border-box;
105
}
116

127
body {
@@ -24,8 +19,24 @@ body {
2419
align-items: center;
2520
}
2621

22+
.swagger-back-link:hover {
23+
text-decoration: underline;
24+
}
25+
2726
.swagger-back-link svg {
2827
color: inherit;
2928
fill: currentcolor;
3029
margin-right: 0.5rem;
3130
}
31+
32+
@media (prefers-color-scheme: dark) {
33+
body {
34+
background: #1e1e1e;
35+
}
36+
.swagger-ui, .swagger-back-link {
37+
filter: invert(88%) hue-rotate(180deg);
38+
}
39+
.swagger-ui .microlight {
40+
filter: invert(100%) hue-rotate(180deg);
41+
}
42+
}

0 commit comments

Comments
 (0)