Skip to content

Commit 978ff8b

Browse files
authored
Merge pull request #931 from vsalvino/darkmode
Add dark mode, and other design changes for the HTML report.
2 parents 1e47b80 + bcd571b commit 978ff8b

28 files changed

+682
-247
lines changed

coverage/htmlfiles/pyfile.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ <h1>Coverage for <b>{{relative_filename|escape}}</b> :
3333

3434
<h2 class="stats">
3535
{{nums.n_statements}} statements &nbsp;
36-
<span class="{{category.run}} shortkey_r button_toggle_run">{{nums.n_executed}} run</span>
37-
<span class="{{category.mis}} shortkey_m button_toggle_mis">{{nums.n_missing}} missing</span>
38-
<span class="{{category.exc}} shortkey_x button_toggle_exc">{{nums.n_excluded}} excluded</span>
36+
<button type="button" class="{{category.run}} shortkey_r button_toggle_run" title="Toggle lines run">{{nums.n_executed}} run</button>
37+
<button type="button" class="{{category.mis}} shortkey_m button_toggle_mis" title="Toggle lines missing">{{nums.n_missing}} missing</button>
38+
<button type="button" class="{{category.exc}} shortkey_x button_toggle_exc" title="Toggle lines excluded">{{nums.n_excluded}} excluded</button>
3939

4040
{% if has_arcs %}
41-
<span class="{{category.par}} shortkey_p button_toggle_par">{{nums.n_partial_branches}} partial</span>
41+
<button type="button" class="{{category.par}} shortkey_p button_toggle_par" title="Toggle lines partially run">{{nums.n_partial_branches}} partial</button>
4242
{% endif %}
4343
</h2>
4444
</div>

coverage/htmlfiles/style.css

Lines changed: 201 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
/* Don't edit this .css file. Edit the .scss file instead! */
55
html, body, h1, h2, h3, p, table, td, th { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; }
66

7-
body { font-family: georgia, serif; font-size: 1em; }
7+
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 1em; background: #fff; color: #000; }
8+
9+
@media (prefers-color-scheme: dark) { body { background: #1e1e1e; } }
10+
11+
@media (prefers-color-scheme: dark) { body { color: #eee; } }
812

913
html > body { font-size: 16px; }
1014

11-
p { font-size: .75em; line-height: 1.33333333em; }
15+
a:active, a:focus { outline: 2px dashed #007acc; }
16+
17+
p { font-size: .875em; line-height: 1.4em; }
1218

1319
table { border-collapse: collapse; }
1420

@@ -19,106 +25,259 @@ table tr.hidden { display: none !important; }
1925
p#no_rows { display: none; font-size: 1.2em; }
2026

2127
a.nav { text-decoration: none; color: inherit; }
28+
2229
a.nav:hover { text-decoration: underline; color: inherit; }
2330

2431
#header { background: #f8f8f8; width: 100%; border-bottom: 1px solid #eee; }
2532

33+
@media (prefers-color-scheme: dark) { #header { background: black; } }
34+
35+
@media (prefers-color-scheme: dark) { #header { border-color: #333; } }
36+
2637
.indexfile #footer { margin: 1em 3em; }
2738

2839
.pyfile #footer { margin: 1em 1em; }
2940

30-
#footer .content { padding: 0; font-size: 85%; font-family: verdana, sans-serif; color: #666666; font-style: italic; }
41+
#footer .content { padding: 0; color: #666; font-style: italic; }
42+
43+
@media (prefers-color-scheme: dark) { #footer .content { color: #aaa; } }
3144

3245
#index { margin: 1em 0 0 3em; }
3346

3447
#header .content { padding: 1em 3rem; }
3548

3649
h1 { font-size: 1.25em; display: inline-block; }
3750

38-
#filter_container { display: inline-block; float: right; margin: 0 2em 0 0; }
39-
#filter_container input { width: 10em; }
51+
#filter_container { float: right; margin: 0 2em 0 0; }
52+
53+
#filter_container input { width: 10em; padding: 0.2em 0.5em; border: 2px solid #ccc; background: #fff; color: #000; }
54+
55+
@media (prefers-color-scheme: dark) { #filter_container input { border-color: #444; } }
56+
57+
@media (prefers-color-scheme: dark) { #filter_container input { background: #1e1e1e; } }
58+
59+
@media (prefers-color-scheme: dark) { #filter_container input { color: #eee; } }
60+
61+
#filter_container input:focus { border-color: #007acc; }
4062

4163
h2.stats { margin-top: .5em; font-size: 1em; }
4264

43-
.stats span { border: 1px solid; border-radius: .1em; padding: .1em .5em; margin: 0 .1em; cursor: pointer; border-color: #ccc #999 #999 #ccc; }
44-
.stats span.run { background: #eeffee; }
45-
.stats span.run.show_run { border-color: #999 #ccc #ccc #999; background: #ddffdd; }
46-
.stats span.mis { background: #ffeeee; }
47-
.stats span.mis.show_mis { border-color: #999 #ccc #ccc #999; background: #ffdddd; }
48-
.stats span.exc { background: #f7f7f7; }
49-
.stats span.exc.show_exc { border-color: #999 #ccc #ccc #999; background: #eeeeee; }
50-
.stats span.par { background: #ffffd5; }
51-
.stats span.par.show_par { border-color: #999 #ccc #ccc #999; background: #ffffaa; }
65+
.stats button { font-family: inherit; font-size: inherit; border: 2px solid; border-radius: .1em; color: inherit; padding: .1em .5em; margin: 0 .1em; cursor: pointer; border-color: #ccc; }
66+
67+
@media (prefers-color-scheme: dark) { .stats button { border-color: #444; } }
68+
69+
.stats button:active, .stats button:focus { outline: 2px dashed #007acc; }
70+
71+
.stats button:active, .stats button:focus { outline: 2px dashed #007acc; }
72+
73+
.stats button.run { background: #eeffee; }
74+
75+
@media (prefers-color-scheme: dark) { .stats button.run { background: #373d29; } }
76+
77+
.stats button.run.show_run { background: #dfd; border-color: #00dd00; }
78+
79+
@media (prefers-color-scheme: dark) { .stats button.run.show_run { background: #373d29; } }
80+
81+
.stats button.mis { background: #ffeeee; }
82+
83+
@media (prefers-color-scheme: dark) { .stats button.mis { background: #4b1818; } }
84+
85+
.stats button.mis.show_mis { background: #fdd; border-color: #ff0000; }
86+
87+
@media (prefers-color-scheme: dark) { .stats button.mis.show_mis { background: #4b1818; } }
88+
89+
.stats button.exc { background: #f7f7f7; }
90+
91+
@media (prefers-color-scheme: dark) { .stats button.exc { background: #333; } }
92+
93+
.stats button.exc.show_exc { background: #eee; border-color: #808080; }
94+
95+
@media (prefers-color-scheme: dark) { .stats button.exc.show_exc { background: #333; } }
96+
97+
.stats button.par { background: #ffffd5; }
5298

53-
#source p .annotate.long, .help_panel { display: none; position: absolute; z-index: 999; background: #ffffcc; border: 1px solid #888; border-radius: .2em; box-shadow: #cccccc .2em .2em .2em; color: #333; padding: .25em .5em; }
99+
@media (prefers-color-scheme: dark) { .stats button.par { background: #650; } }
100+
101+
.stats button.par.show_par { background: #ffa; border-color: #dddd00; }
102+
103+
@media (prefers-color-scheme: dark) { .stats button.par.show_par { background: #650; } }
104+
105+
.help_panel, #source p .annotate.long { display: none; position: absolute; z-index: 999; background: #ffffcc; border: 1px solid #888; border-radius: .2em; color: #333; padding: .25em .5em; }
54106

55107
#source p .annotate.long { white-space: normal; float: right; top: 1.75em; right: 1em; height: auto; }
56108

57109
#keyboard_icon { float: right; margin: 5px; cursor: pointer; }
58110

59111
.help_panel { padding: .5em; border: 1px solid #883; }
112+
60113
.help_panel .legend { font-style: italic; margin-bottom: 1em; }
61-
.indexfile .help_panel { width: 20em; height: 4em; }
62-
.pyfile .help_panel { width: 16em; height: 8em; }
114+
115+
.indexfile .help_panel { width: 20em; min-height: 4em; }
116+
117+
.pyfile .help_panel { width: 16em; min-height: 8em; }
63118

64119
#panel_icon { float: right; cursor: pointer; }
65120

66121
.keyhelp { margin: .75em; }
67-
.keyhelp .key { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em .35em; font-family: monospace; font-weight: bold; background: #eee; }
68122

69-
#source { padding: 1em 0 1em 3rem; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
123+
.keyhelp .key { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em .35em; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: bold; background: #eee; }
124+
125+
#source { padding: 1em 0 1em 3rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
126+
70127
#source p { position: relative; white-space: pre; }
128+
71129
#source p * { box-sizing: border-box; }
72-
#source p .n { float: left; text-align: right; width: 3rem; box-sizing: border-box; margin-left: -3rem; padding-right: 1em; color: #999999; font-family: verdana, sans-serif; }
73-
#source p .n a { text-decoration: none; color: #999999; font-size: .8333em; line-height: 1em; }
74-
#source p .n a:hover { text-decoration: underline; color: #999999; }
130+
131+
#source p .n { float: left; text-align: right; width: 3rem; box-sizing: border-box; margin-left: -3rem; padding-right: 1em; color: #999; }
132+
133+
@media (prefers-color-scheme: dark) { #source p .n { color: #777; } }
134+
135+
#source p .n a { text-decoration: none; color: #999; }
136+
137+
@media (prefers-color-scheme: dark) { #source p .n a { color: #777; } }
138+
139+
#source p .n a:hover { text-decoration: underline; color: #999; }
140+
141+
@media (prefers-color-scheme: dark) { #source p .n a:hover { color: #777; } }
142+
75143
#source p.highlight .n { background: #ffdd00; }
76-
#source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid white; }
144+
145+
#source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid #fff; }
146+
147+
@media (prefers-color-scheme: dark) { #source p .t { border-color: #1e1e1e; } }
148+
77149
#source p .t:hover { background: #f2f2f2; }
150+
151+
@media (prefers-color-scheme: dark) { #source p .t:hover { background: #282828; } }
152+
78153
#source p .t:hover ~ .r .annotate.long { display: block; }
79-
#source p .t .com { color: green; font-style: italic; line-height: 1px; }
154+
155+
#source p .t .com { color: #008000; font-style: italic; line-height: 1px; }
156+
157+
@media (prefers-color-scheme: dark) { #source p .t .com { color: #6A9955; } }
158+
80159
#source p .t .key { font-weight: bold; line-height: 1px; }
81-
#source p .t .str { color: #000080; }
160+
161+
#source p .t .str { color: #0451A5; }
162+
163+
@media (prefers-color-scheme: dark) { #source p .t .str { color: #9CDCFE; } }
164+
82165
#source p.mis .t { border-left: 0.2em solid #ff0000; }
83-
#source p.mis.show_mis .t { background: #ffdddd; }
166+
167+
#source p.mis.show_mis .t { background: #fdd; }
168+
169+
@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t { background: #4b1818; } }
170+
84171
#source p.mis.show_mis .t:hover { background: #f2d2d2; }
85-
#source p.run .t { border-left: 0.2em solid #00ff00; }
86-
#source p.run.show_run .t { background: #ddffdd; }
172+
173+
@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t:hover { background: #532323; } }
174+
175+
#source p.run .t { border-left: 0.2em solid #00dd00; }
176+
177+
#source p.run.show_run .t { background: #dfd; }
178+
179+
@media (prefers-color-scheme: dark) { #source p.run.show_run .t { background: #373d29; } }
180+
87181
#source p.run.show_run .t:hover { background: #d2f2d2; }
182+
183+
@media (prefers-color-scheme: dark) { #source p.run.show_run .t:hover { background: #404633; } }
184+
88185
#source p.exc .t { border-left: 0.2em solid #808080; }
89-
#source p.exc.show_exc .t { background: #eeeeee; }
186+
187+
#source p.exc.show_exc .t { background: #eee; }
188+
189+
@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t { background: #333; } }
190+
90191
#source p.exc.show_exc .t:hover { background: #e2e2e2; }
91-
#source p.par .t { border-left: 0.2em solid #eeee99; }
92-
#source p.par.show_par .t { background: #ffffaa; }
192+
193+
@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t:hover { background: #3c3c3c; } }
194+
195+
#source p.par .t { border-left: 0.2em solid #dddd00; }
196+
197+
#source p.par.show_par .t { background: #ffa; }
198+
199+
@media (prefers-color-scheme: dark) { #source p.par.show_par .t { background: #650; } }
200+
93201
#source p.par.show_par .t:hover { background: #f2f2a2; }
94-
#source p .r { position: absolute; top: 0; right: 2.5em; font-family: verdana, sans-serif; }
95-
#source p .annotate { font-family: georgia; color: #666; padding-right: .5em; }
202+
203+
@media (prefers-color-scheme: dark) { #source p.par.show_par .t:hover { background: #6d5d0c; } }
204+
205+
#source p .r { position: absolute; top: 0; right: 2.5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; }
206+
207+
#source p .annotate { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #666; padding-right: .5em; }
208+
209+
@media (prefers-color-scheme: dark) { #source p .annotate { color: #ddd; } }
210+
96211
#source p .annotate.short:hover ~ .long { display: block; }
212+
97213
#source p .annotate.long { width: 30em; right: 2.5em; }
214+
98215
#source p input { display: none; }
216+
99217
#source p input ~ .r label.ctx { cursor: pointer; border-radius: .25em; }
218+
100219
#source p input ~ .r label.ctx::before { content: "▶ "; }
220+
101221
#source p input ~ .r label.ctx:hover { background: #d5f7ff; color: #666; }
222+
102223
#source p input:checked ~ .r label.ctx { background: #aaeeff; color: #666; border-radius: .75em .75em 0 0; padding: 0 .5em; margin: -.25em 0; }
224+
103225
#source p input:checked ~ .r label.ctx::before { content: "▼ "; }
226+
104227
#source p input:checked ~ .ctxs { padding: .25em .5em; overflow-y: scroll; max-height: 10.5em; }
228+
105229
#source p label.ctx { color: #999; display: inline-block; padding: 0 .5em; font-size: .8333em; }
106-
#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: verdana, sans-serif; white-space: nowrap; background: #aaeeff; border-radius: .25em; margin-right: 1.75em; }
230+
231+
@media (prefers-color-scheme: dark) { #source p label.ctx { color: #777; } }
232+
233+
#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #aaeeff; border-radius: .25em; margin-right: 1.75em; }
234+
107235
#source p .ctxs span { display: block; text-align: right; }
108236

237+
#index { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.875em; }
238+
109239
#index td, #index th { text-align: right; width: 5em; padding: .25em .5em; border-bottom: 1px solid #eee; }
240+
241+
@media (prefers-color-scheme: dark) { #index td, #index th { border-color: #333; } }
242+
110243
#index td.left, #index th.left { padding-left: 0; }
244+
111245
#index td.right, #index th.right { padding-right: 0; }
246+
112247
#index td.name, #index th.name { text-align: left; width: auto; }
113-
#index th { font-style: italic; color: #333; border-bottom: 1px solid #ccc; cursor: pointer; }
114-
#index th:hover { background: #eee; border-bottom: 1px solid #999; }
115-
#index th.headerSortDown, #index th.headerSortUp { border-bottom: 1px solid #000; white-space: nowrap; background: #eee; }
248+
249+
#index th { font-style: italic; color: #333; cursor: pointer; }
250+
251+
@media (prefers-color-scheme: dark) { #index th { color: #ddd; } }
252+
253+
#index th:hover { background: #eee; }
254+
255+
@media (prefers-color-scheme: dark) { #index th:hover { background: #333; } }
256+
257+
#index th.headerSortDown, #index th.headerSortUp { white-space: nowrap; background: #eee; }
258+
259+
@media (prefers-color-scheme: dark) { #index th.headerSortDown, #index th.headerSortUp { background: #333; } }
260+
116261
#index th.headerSortDown:after { content: " ↓"; }
262+
117263
#index th.headerSortUp:after { content: " ↑"; }
118-
#index td.name a { text-decoration: none; color: #000; }
264+
265+
#index td.name a { text-decoration: none; color: inherit; }
266+
119267
#index tr.total td, #index tr.total_dynamic td { font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; }
120-
#index tr.file:hover { background: #eeeeee; }
121-
#index tr.file:hover td.name { text-decoration: underline; color: #000; }
122268

123-
#scroll_marker { position: fixed; right: 0; top: 0; width: 16px; height: 100%; background: white; border-left: 1px solid #eee; will-change: transform; }
124-
#scroll_marker .marker { background: #ddd; position: absolute; min-height: 3px; width: 100%; }
269+
#index tr.file:hover { background: #eee; }
270+
271+
@media (prefers-color-scheme: dark) { #index tr.file:hover { background: #333; } }
272+
273+
#index tr.file:hover td.name { text-decoration: underline; color: inherit; }
274+
275+
#scroll_marker { position: fixed; right: 0; top: 0; width: 16px; height: 100%; background: #fff; border-left: 1px solid #eee; will-change: transform; }
276+
277+
@media (prefers-color-scheme: dark) { #scroll_marker { background: #1e1e1e; } }
278+
279+
@media (prefers-color-scheme: dark) { #scroll_marker { border-color: #333; } }
280+
281+
#scroll_marker .marker { background: #ccc; position: absolute; min-height: 3px; width: 100%; }
282+
283+
@media (prefers-color-scheme: dark) { #scroll_marker .marker { background: #444; } }

0 commit comments

Comments
 (0)