Skip to content

Commit 578b752

Browse files
Add missing CSS for the OpenAPI plugin, fix #59 (#66)
* Fix #59
1 parent 7a5df89 commit 578b752

File tree

2 files changed

+192
-0
lines changed

2 files changed

+192
-0
lines changed

styles/all.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
@import "./cards.scss";
1111
@import "./spantable.scss";
1212
@import "./contribs.scss";
13+
@import "./oad.scss";

styles/oad.scss

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/**
2+
* CSS for OpenAPI HTML generated with PyMdown Extensions option.
3+
*
4+
* This CSS file works when using the OAD plugin with pymdownx.
5+
* See here how to use it:
6+
* https://www.neoteroi.dev/mkdocs-plugins/web/oad/
7+
*
8+
* https://github.com/Neoteroi/mkdocs-plugins
9+
**/
10+
11+
:root {
12+
--http-get-color: green;
13+
--http-delete-color: #dc0101;
14+
--http-head-color: slateblue;
15+
--http-options-color: steelblue;
16+
--http-patch-color: darkorange;
17+
--http-post-color: darkblue;
18+
--http-put-color: darkmagenta;
19+
--http-trace-color: darkcyan;
20+
--http-route-param-color: rgb(51, 128, 210);
21+
--oad-operation-separator-border-color: gray;
22+
--oad-block-border-color: #00bfa5;
23+
--oad-small-note-color: #666;
24+
--oad-indent-border-color: #c5c5c5;
25+
}
26+
27+
@media screen {
28+
/* Slate theme, i.e. dark mode */
29+
[data-md-color-scheme="slate"] {
30+
--http-get-color: #2ea82e;
31+
--http-post-color: #0093c0;
32+
--http-put-color: #c333c3;
33+
--oad-small-note-color: #afafaf;
34+
}
35+
}
36+
37+
.api-tag {
38+
font-weight: bold;
39+
}
40+
41+
span[class^="http-"] {
42+
font-weight: bold;
43+
color: #fff;
44+
padding: 4px 1rem;
45+
border-radius: 2px;
46+
margin-right: .5rem;
47+
}
48+
49+
.http-get {
50+
background-color: var(--http-get-color);
51+
}
52+
53+
.http-delete {
54+
background-color: var(--http-delete-color);
55+
}
56+
57+
.http-post {
58+
background-color: var(--http-post-color);
59+
}
60+
61+
.http-patch {
62+
background-color: var(--http-patch-color);
63+
}
64+
65+
.http-trace {
66+
background-color: var(--http-trace-color);
67+
}
68+
69+
.http-put {
70+
background-color: var(--http-put-color);
71+
}
72+
73+
.http-head {
74+
background-color: var(--http-head-color);
75+
}
76+
77+
.http-options {
78+
background-color: var(--http-options-color);
79+
}
80+
81+
.route-param {
82+
color: var(--http-route-param-color);
83+
}
84+
85+
.operation-separator + h3[id^="get"] .route-param {
86+
color: var(--http-get-color);
87+
}
88+
89+
.operation-separator + h3[id^="delete"] .route-param {
90+
color: var(--http-delete-color);
91+
}
92+
93+
94+
.operation-separator + h3[id^="post"] .route-param {
95+
color: var(--http-post-color);
96+
}
97+
98+
.operation-separator + h3[id^="patch"] .route-param {
99+
color: var(--http-patch-color);
100+
}
101+
102+
.operation-separator + h3[id^="trace"] .route-param {
103+
color: var(--http-trace-color);
104+
}
105+
106+
.operation-separator + h3[id^="put"] .route-param {
107+
color: var(--http-put-color);
108+
}
109+
110+
.operation-separator + h3[id^="head"] .route-param {
111+
color: var(--http-head-color);
112+
}
113+
114+
.operation-separator + h3[id^="options"] .route-param {
115+
color: var(--http-options-color);
116+
}
117+
118+
.api-version {
119+
font-size: 1.2rem;
120+
}
121+
122+
.operation-separator {
123+
margin: 0 !important;
124+
border-bottom: 2px dotted var(--oad-operation-separator-border-color) !important;
125+
padding-top: .5rem;
126+
}
127+
128+
.operation-separator + h3 {
129+
margin-top: 1rem;
130+
}
131+
132+
.string-type {
133+
color: var(--md-code-hl-string-color);
134+
}
135+
136+
.integer-type, .number-type {
137+
color: var(--md-code-hl-number-color);
138+
}
139+
140+
.boolean-type {
141+
color: var(--md-code-hl-keyword-color);
142+
}
143+
144+
.format {
145+
color: var(--md-code-hl-name-color);
146+
}
147+
148+
.null-type {
149+
color: var(--md-code-hl-keyword-color);
150+
}
151+
152+
a.ref-link {
153+
color: var(--md-code-hl-special-color);
154+
}
155+
156+
.request-block + div {
157+
padding-left: 1rem;
158+
border-left: 2px dashed var(--oad-block-border-color);
159+
}
160+
161+
.small-note {
162+
font-size: 14px;
163+
color: var(--oad-small-note-color);
164+
}
165+
166+
.request-body-title {
167+
margin-bottom: 4px;
168+
}
169+
170+
.request-body-title + .tabbed-set,
171+
.response-title + .tabbed-set,
172+
.message-separator + .tabbed-set,
173+
.common-response,
174+
.response-section {
175+
margin-top: 2px;
176+
padding-left: 1rem;
177+
border-left: 2px dotted var(--oad-indent-border-color);
178+
}
179+
180+
.info-data {
181+
font-size: .6rem;
182+
}
183+
184+
.message-separator {
185+
visibility: hidden;
186+
}
187+
188+
.sub-section-title {
189+
font-style: italic;
190+
font-size: 14px;
191+
}

0 commit comments

Comments
 (0)