Skip to content

Commit ab8167d

Browse files
committed
Refactor site SCSS, and follow user dark/light mode preference.
Darkly is still a predominantly dark-theme skin, but has small variations between dark and light mode. A lot of color and pixel-specific settings have been removed as the stock theme is actually surprisingly close what we want. Additionally, having these was hindering correct light/dark mode display. Removing these also allows us to be more flexible with which Bootswatch themes we can use. Many definitions have been moved around to better fit the nesting of SCSS, reducing clutter and increasing readability. Supersedes #154 Fixes #33 Fixes #151
1 parent 0aa64ad commit ab8167d

1 file changed

Lines changed: 63 additions & 140 deletions

File tree

site/assets/css/site.scss

Lines changed: 63 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -4,134 +4,74 @@
44
---
55

66
@import "darkly/variables";
7+
$color-mode-type: media-query;
78
@import "_bootstrap";
89
@import "darkly/bootswatch";
910

1011
@import "markdown-mixins";
1112
@import "anchor-blink";
1213

14+
// nav title ("OpenTabletDriver")
1315
a.navbar-brand {
1416
white-space: normal;
1517
text-align: center;
1618
word-break: break-all;
1719
}
1820

19-
/* Provide sufficient contrast against white background */
20-
a {
21-
color: #0366d6;
22-
}
23-
24-
.btn-primary {
25-
color: #fff;
26-
background-color: #1b6ec2;
27-
border-color: #1861ac;
28-
}
29-
30-
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
31-
color: #fff;
32-
background-color: #1b6ec2;
33-
border-color: #1861ac;
34-
}
35-
36-
/* Sticky footer styles
37-
-------------------------------------------------- */
38-
html {
39-
font-size: 14px;
40-
}
41-
42-
@media (min-width: 768px) {
43-
html {
44-
font-size: 16px;
45-
}
46-
}
47-
48-
.border-top {
49-
border-top: 1px solid #e5e5e5;
50-
}
51-
52-
.border-bottom {
53-
border-bottom: 1px solid #e5e5e5;
54-
}
55-
21+
// used in <nav>
5622
.box-shadow {
5723
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
5824
}
5925

60-
button.accept-policy {
61-
font-size: 1rem;
62-
line-height: inherit;
63-
}
64-
65-
/* Sticky footer styles
66-
-------------------------------------------------- */
67-
html {
68-
position: relative;
69-
min-height: 100%;
70-
}
71-
72-
.table {
73-
--bs-table-accent-bg: #303030;
74-
}
75-
26+
// used with Tablets table description
7627
.dropmargins {
7728
margin: 0;
7829
}
7930

80-
#toc a {
81-
color:#c4cfda;
82-
text-decoration: none;
83-
}
84-
85-
#toc a:focus,
86-
#toc a:hover {
87-
color:#bdc4ca;
88-
}
89-
31+
// Table of Contents, e.g. on Wiki pages
9032
#toc {
9133
margin-top: 0.8em;
9234
padding-left: 1em;
93-
}
9435

95-
#toc ul {
96-
padding-left: 1.5em;
97-
}
36+
a {
37+
text-decoration: none;
38+
}
39+
40+
ul {
41+
padding-left: 1.5em;
42+
}
9843

99-
#toc li {
100-
padding-left: 1ex;
44+
li {
45+
padding-left: 1ex;
46+
}
10147
}
10248

49+
// <li>'s get too packed without this
10350
li {
104-
margin-top: 6px;
105-
margin-bottom: 6px;
51+
margin-top: 0.5em;
52+
margin-bottom: 0.5em;
10653
}
10754

55+
// parsed code blocks that has syntax highlighting
10856
div.highlighter-rouge {
10957
margin-top: 1em;
11058
margin-bottom: 1em;
111-
}
11259

113-
div.highlighter-rouge pre.highlight {
114-
padding: 1em;
60+
pre.highlight {
61+
padding: 1em;
62+
}
11563
}
11664

11765
#page-title {
11866
@include markdown-header;
119-
font-size: calc(1.375em + 1.5vw);
120-
}
121-
122-
@media (min-width: 1200px) {
123-
#page-title {
124-
font-size: 2.5rem;
125-
}
12667
}
12768

12869
#toc-container {
129-
visibility: collapse;
130-
}
131-
132-
#toc-container > div {
133-
position: sticky;
134-
top: 1.5em;
70+
visibility: collapse; // hide on smaller devices (see later media rules)
71+
> div {
72+
position: sticky; // always keep in view
73+
top: 1.5em; // spacing from top when sticky is acting
74+
}
13575
}
13676

13777
@media (min-width: 576px) {
@@ -140,61 +80,44 @@ div.highlighter-rouge pre.highlight {
14080
}
14181
}
14282

143-
@media (min-width: 576px) {
144-
.markdown-content {
145-
padding-left: 2em;
146-
}
147-
}
148-
14983
.markdown-content {
15084
h2 {
151-
font-size: 1.55em;
15285
counter-increment: h2-section;
86+
> span::before {
87+
content: counter(h2-section) ".";
88+
}
15389
}
90+
15491
h3 {
155-
font-size: 1.45em;
15692
counter-increment: h3-section;
15793
~ h2 {
15894
counter-reset: h3-section;
15995
}
96+
> span::before {
97+
content: counter(h2-section) "." counter(h3-section) ".";
98+
}
16099
}
100+
161101
h4 {
162-
font-size: 1.28em;
163102
counter-increment: h4-section;
164103
~ h3 {
165104
counter-reset: h4-section;
166105
}
167-
}
168-
h5 {
169-
font-size: 1.16em;
170-
}
171-
h6 {
172-
font-size: 1em;
173-
}
174-
175-
h2 > span::before {
176-
content: counter(h2-section) "."
177-
}
178-
179-
h3 > span::before {
180-
content: counter(h2-section) "." counter(h3-section) "."
181-
}
182-
183-
h4 > span::before {
184-
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) "."
106+
> span::before {
107+
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) ".";
108+
}
185109
}
186110

187111
h2, h3 {
188-
@include markdown-header
112+
@include markdown-header;
189113
}
190114

191-
h2 > span::before,
192-
h3 > span::before,
193-
h4 > span::before,
194-
h5 > span::before {
195-
color:#c0c0c0;
196-
font-style: italic;
197-
margin-right: 1ex;
115+
h2, h3, h4, h5 {
116+
// counter display
117+
> span::before {
118+
font-style: italic;
119+
margin-right: 1ex;
120+
}
198121
}
199122
}
200123

@@ -203,30 +126,30 @@ div.highlighter-rouge pre.highlight {
203126
&::marker {
204127
content: counter(h2-section) ".";
205128
}
206-
}
207129

208-
#toc > li > ul > li {
209-
counter-increment: h3-section;
210-
&::marker {
211-
content: counter(h2-section) "." counter(h3-section) ".";
212-
}
213-
&:last-child {
214-
counter-reset: h3-section;
215-
}
216-
}
130+
> ul > li {
131+
counter-increment: h3-section;
132+
&::marker {
133+
content: counter(h2-section) "." counter(h3-section) ".";
134+
}
135+
&:first-child {
136+
counter-reset: h3-section;
137+
}
217138

218-
#toc > li > ul > li > ul > li {
219-
counter-increment: h4-section;
220-
&::marker {
221-
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) ".";
222-
}
223-
&:last-child {
224-
counter-reset: h4-section;
139+
> ul > li {
140+
counter-increment: h4-section;
141+
&::marker {
142+
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) ".";
143+
}
144+
&:first-child {
145+
counter-reset: h4-section;
146+
}
147+
}
225148
}
226149
}
227150

228151
.markdown-content blockquote > p:last-child {
229-
margin-bottom: 0px;
152+
margin-bottom: 0;
230153
}
231154

232155
.alert-compact {

0 commit comments

Comments
 (0)