-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathdark-mode.css
More file actions
195 lines (164 loc) · 4.43 KB
/
dark-mode.css
File metadata and controls
195 lines (164 loc) · 4.43 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/* Dark Mode Styles for Learn You a Haskell */
/* Dark mode is activated by adding 'dark-mode' class to body */
body.dark-mode {
background-color: #1a1a1a;
color: #e0e0e0;
}
body.dark-mode.introcontent {
/* Add a semi-transparent dark overlay on top of bg.png */
background-image: linear-gradient(rgba(26, 26, 26, 0.75), rgba(26, 26, 26, 0.75)), url(../images/bg.png);
background-color: #1a1a1a;
}
body.dark-mode .bgwrapper {
background-color: #1a1a1a;
}
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
color: #e0e0e0;
}
body.dark-mode a {
color: #66b3ff;
}
body.dark-mode a:visited {
color: #9999ff;
}
body.dark-mode a:hover {
color: #ff6666;
}
body.dark-mode :not(pre) > code:not(.label, .function, .type, .class, .law) {
background-color: #2d2d2d;
color: #e0e0e0;
}
body.dark-mode pre > code {
background-color: #0d0d0d;
color: #90ee90;
}
body.dark-mode .hintbox {
background-color: #2d2d1a;
background-image: none !important;
color: #f0f0f0;
border: 1px solid #5a5a3a;
}
body.dark-mode .chapters > li > a {
color: #e0e0e0;
border-bottom: 1px solid #404040;
}
body.dark-mode .chapters > li > a:visited {
color: #b0b0b0;
}
body.dark-mode .chapters > li > a:hover {
color: #ff6666;
}
body.dark-mode .chapters > li > ul > li > a {
color: #e0e0e0;
}
body.dark-mode .chapters > li > ul > li > a:visited {
color: #b0b0b0;
}
body.dark-mode .chapters > li > ul > li > a:hover {
color: #ff6666;
}
body.dark-mode .errata {
background-color: #3d1a1a;
color: #e0e0e0;
}
/* Dark mode toggle button */
.dark-mode-toggle {
position: fixed;
top: 40px;
right: 20px;
/* Using z-index 10000 to match the Ukraine banner and ensure visibility */
z-index: 10000;
background-color: #333;
color: white;
border: 2px solid #555;
border-radius: 50%;
width: 50px;
height: 50px;
cursor: pointer;
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.dark-mode-toggle:hover {
background-color: #444;
transform: scale(1.1);
}
body.dark-mode .dark-mode-toggle {
background-color: #f0f0f0;
color: #333;
border-color: #ccc;
}
body.dark-mode .dark-mode-toggle:hover {
background-color: #e0e0e0;
}
/* Adjust toggle button for mobile */
@media screen and (max-width: 600px) {
.dark-mode-toggle {
width: 45px;
height: 45px;
font-size: 20px;
top: 40px;
right: 10px;
}
}
/* Dark mode for index page specific elements */
body.dark-mode {
background-color: #1a1a1a !important;
}
body.dark-mode #newsplash {
color: #e0e0e0;
background-color: #1a1a1a !important;
position: relative;
overflow: hidden; /* Prevent content from spilling outside the container */
}
/* Add a dark overlay using pseudo-element to dim background while keeping text readable */
body.dark-mode #newsplash::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(26, 26, 26, 0.40);
pointer-events: none;
z-index: 0;
}
/* Ensure content is above the overlay and constrain width to prevent overflow */
/* The text div is absolutely positioned, so we need to constrain it with explicit left/right */
/* Parent container is 880px wide, text should wrap within it with proper margins */
body.dark-mode #newsplash > div[style*="position:absolute"] {
position: absolute !important; /* Keep original positioning */
z-index: 1;
left: 0 !important;
right: 20px !important; /* 20px margin on the right to prevent overflow */
padding-left: 20px; /* Match the left padding to keep text centered */
padding-right: 20px; /* Additional padding for safety */
box-sizing: border-box;
}
body.dark-mode .newsplash a.nostarchlink {
color: #66b3ff;
}
body.dark-mode .newsplash a.nostarchlink:hover {
color: #ff6666;
}
/* Make index page buttons slightly more visible in dark mode without hiding graphics */
body.dark-mode #faq-button,
body.dark-mode #book-button,
body.dark-mode #read-button {
/* Keep the buttons as clickable areas over the dimmed graphics */
opacity: 1;
}
/* Handle image backgrounds in dark mode */
body.dark-mode img {
opacity: 0.9;
background-color: transparent;
}
/* Keep images at full opacity when needed */
body.dark-mode img.full-opacity {
opacity: 1;
}