forked from XiangyunHuang/ElegantBookdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.html
76 lines (72 loc) · 3.41 KB
/
header.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
Macros: {
bm: ["{\\boldsymbol #1}",1],
},
extensions: ["cancel.js"]
}
});
</script>
<!-- add line break after theorem title -->
<script>
document.addEventListener("DOMContentLoaded", (event) => {
for (let s of document.querySelectorAll("span.theorem, span.lemma, span.proposition, span.corollary")) {
s.insertAdjacentHTML('afterend', '<br style="line-height:2px;"/>');
}
});
</script>
<!-- check if --themcolor in style.css matches one of elegantbook theme colors. If so, generates the color palette -->
<script>
document.addEventListener("DOMContentLoaded", (event) => {
const cssroot = document.querySelector(':root');
let theme_color = getComputedStyle(document.documentElement).getPropertyValue('--themecolor').trim();
// blue is the default option
switch (theme_color) {
case 'green':
cssroot.style.setProperty('--structurecolor', 'rgb(0,120,2)');
cssroot.style.setProperty('--main', 'rgb(70,70,70)');
cssroot.style.setProperty('--mainbg', 'rgba(0,166,82,0.05)');
cssroot.style.setProperty('--second', 'rgb(115,45,2)');
cssroot.style.setProperty('--secondbg', 'rgba(115,45,2,0.05)');
cssroot.style.setProperty('--third', 'rgb(0,80,80)');
cssroot.style.setProperty('--thirdbg', 'rgba(0,80,80,0.05)');
break;
case 'cyan':
cssroot.style.setProperty('--structurecolor', 'rgb(31,186,190)');
cssroot.style.setProperty('--main', 'rgb(59,180,5)');
cssroot.style.setProperty('--mainbg', 'rgba(59,180,5,0.05)');
cssroot.style.setProperty('--second', 'rgb(175,153,8)');
cssroot.style.setProperty('--secondbg', 'rgba(175,153,8,0.05)');
cssroot.style.setProperty('--third', 'rgb(244,105,102)');
cssroot.style.setProperty('--thirdbg', 'rgba(244,105,102,0.05)');
break;
case 'gray':
cssroot.style.setProperty('--structurecolor', 'rgb(150,150,150)');
cssroot.style.setProperty('--main', 'rgb(150,150,150)');
cssroot.style.setProperty('--mainbg', 'rgba(150,150,150,0.05)');
cssroot.style.setProperty('--second', 'rgb(150,150,150)');
cssroot.style.setProperty('--secondbg', 'rgba(150,150,150,0.05)');
cssroot.style.setProperty('--third', 'rgb(150,150,150)');
cssroot.style.setProperty('--thirdbg', 'rgba(150,150,150,0.05)');
break;
case 'black':
cssroot.style.setProperty('--structurecolor', 'rgb(0,0,0)');
cssroot.style.setProperty('--main', 'rgb(0,0,0)');
cssroot.style.setProperty('--mainbg', 'rgba(0,0,0,0.05)');
cssroot.style.setProperty('--second', 'rgb(0,0,0)');
cssroot.style.setProperty('--secondbg', 'rgba(0,0,0,0.05)');
cssroot.style.setProperty('--third', 'rgb(0,0,0)');
cssroot.style.setProperty('--thirdbg', 'rgba(0,0,0,0.05)');
break;
default:
cssroot.style.setProperty('--structurecolor', 'rgb(60,113,183)');
cssroot.style.setProperty('--main', 'rgb(0,166,82)');
cssroot.style.setProperty('--mainbg', 'rgba(0,166,82,0.05)');
cssroot.style.setProperty('--second', 'rgb(255,134,24)');
cssroot.style.setProperty('--secondbg', 'rgba(255,134,24,0.05)');
cssroot.style.setProperty('--third', 'rgb(0,174,247)');
cssroot.style.setProperty('--thirdbg', 'rgba(0,174,247,0.05)');
}
});
</script>