Skip to content

Commit 0142a13

Browse files
Attempt dark mode
1 parent f510c9e commit 0142a13

File tree

8 files changed

+169
-34
lines changed

8 files changed

+169
-34
lines changed

_includes/dark-mode-toggle.html

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!-- Dark Mode Toggle -->
2+
<div class="dark-mode-toggle-container">
3+
<button id="dark-mode-toggle" class="dark-mode-toggle" aria-label="Toggle dark mode">
4+
<span class="toggle-icon">🌙</span>
5+
</button>
6+
</div>
7+
8+
<script>
9+
// Dark mode functionality
10+
(function() {
11+
const toggle = document.getElementById('dark-mode-toggle');
12+
const body = document.body;
13+
const icon = toggle.querySelector('.toggle-icon');
14+
15+
// Check for saved theme preference or default to light mode
16+
const savedTheme = localStorage.getItem('crup-theme') || 'light';
17+
18+
function setTheme(theme) {
19+
if (theme === 'dark') {
20+
body.setAttribute('data-theme', 'dark');
21+
icon.textContent = '☀️';
22+
localStorage.setItem('crup-theme', 'dark');
23+
} else {
24+
body.setAttribute('data-theme', 'light');
25+
icon.textContent = '🌙';
26+
localStorage.setItem('crup-theme', 'light');
27+
}
28+
}
29+
30+
// Apply saved theme on page load
31+
setTheme(savedTheme);
32+
33+
// Toggle theme on button click
34+
toggle.addEventListener('click', function() {
35+
const currentTheme = body.getAttribute('data-theme');
36+
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
37+
setTheme(newTheme);
38+
});
39+
40+
// Listen for system theme changes
41+
if (window.matchMedia) {
42+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function(e) {
43+
if (!localStorage.getItem('crup-theme')) {
44+
setTheme(e.matches ? 'dark' : 'light');
45+
}
46+
});
47+
}
48+
})();
49+
</script>

_layouts/person.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% include dark-mode-toggle.html %}
2+
13
<div class="person">
24
{%- if page.photo -%}
35
<img class="person-image" src="{{ site.baseurl }}{{ page.subpath }}{{ page.photo }}" alt="{{ page.name }} profile photo">

_sass/color_schemes/wider.scss

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,71 @@
11
// wider.scss is already setting the content width
22
$content-width: 75rem;
33

4+
// CSS Variables for light/dark themes
5+
:root {
6+
// Light theme variables
7+
--bg-color: #fafdff;
8+
--text-color: black;
9+
--primary-color: #397DFF;
10+
--primary-hover: #245dcc;
11+
--border-color: #e1e4e8;
12+
--table-header-bg: #e4ecfa;
13+
--table-stripe-bg: #f3f8fe;
14+
--table-border: #c6d5f9;
15+
--table-row-border: #e4ecfa;
16+
--blockquote-bg: #f0f6fe;
17+
--hr-color: #e4ecfa;
18+
--card-bg: #ffffff;
19+
--card-shadow: rgba(0, 0, 0, 0.1);
20+
}
21+
22+
[data-theme="dark"] {
23+
// Dark theme variables
24+
--bg-color: #0d1117;
25+
--text-color: #f0f6fc;
26+
--primary-color: #58a6ff;
27+
--primary-hover: #79c0ff;
28+
--border-color: #30363d;
29+
--table-header-bg: #161b22;
30+
--table-stripe-bg: #0d1117;
31+
--table-border: #21262d;
32+
--table-row-border: #21262d;
33+
--blockquote-bg: #161b22;
34+
--hr-color: #21262d;
35+
--card-bg: #161b22;
36+
--card-shadow: rgba(0, 0, 0, 0.3);
37+
}
38+
439
// Global styles
540

641
body {
742
margin: 0 auto;
843
font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
944
font-size: 1.1rem;
10-
background: #fafdff;
11-
color: black;
45+
background: var(--bg-color);
46+
color: var(--text-color);
47+
transition: background-color 0.3s ease, color 0.3s ease;
1248
}
1349

1450
// Links
1551
a,
1652
a:visited {
17-
color: #397DFF !important; // force blue for all links
53+
color: var(--primary-color) !important;
1854
text-decoration: underline;
1955
font-weight: 500;
2056
transition: color 0.15s;
2157
}
2258

2359
a:hover,
2460
a:focus {
25-
color: #245dcc !important; // force dark blue for hover/focus
61+
color: var(--primary-hover) !important;
2662
text-decoration: underline;
2763
}
2864

2965

3066
// Headings
3167
h1, h2, h3, h4, h5, h6 {
32-
color: #397DFF;
68+
color: var(--primary-color);
3369
font-weight: 700;
3470
margin-top: 2.2rem;
3571
margin-bottom: 1.2rem;
@@ -42,7 +78,7 @@ h1, h2, h3, h4, h5, h6 {
4278

4379
h2 {
4480
font-size: 1.75rem;
45-
border-bottom: 1px solid #e0ebfa;
81+
border-bottom: 1px solid var(--border-color);
4682
padding-bottom: 0.2rem;
4783
}
4884

@@ -57,7 +93,7 @@ h4, h5, h6 {
5793

5894
// Bold text
5995
strong, b {
60-
color: #397DFF;
96+
color: var(--primary-color);
6197
font-weight: 700;
6298
}
6399

@@ -66,30 +102,31 @@ table {
66102
width: 100%;
67103
border-collapse: collapse;
68104
margin: 2rem 0;
69-
background: #fff;
105+
background: var(--card-bg);
70106
font-size: 1rem;
107+
transition: background-color 0.3s ease;
71108
}
72109

73110
thead th {
74-
background: #e4ecfa;
75-
color: #397DFF;
111+
background: var(--table-header-bg);
112+
color: var(--primary-color);
76113
font-weight: 700;
77-
border-bottom: 2px solid #c6d5f9;
114+
border-bottom: 2px solid var(--table-border);
78115
padding: 0.7rem;
79116
}
80117

81118
tbody td {
82-
border-bottom: 1px solid #e4ecfa;
119+
border-bottom: 1px solid var(--table-row-border);
83120
padding: 0.7rem;
84121
vertical-align: top;
85122
}
86123

87124
tbody tr:nth-child(even) {
88-
background: #f3f8fe;
125+
background: var(--table-stripe-bg);
89126
}
90127

91128
.label {
92-
background: #397DFF;
129+
background: var(--primary-color);
93130
color: #fff !important; // ensures text stays white
94131
border-radius: 1.3em;
95132
padding: 0.22em 1.1em;
@@ -114,17 +151,18 @@ img {
114151
}
115152

116153
blockquote {
117-
border-left: 4px solid #397DFF;
118-
background: #f0f6fe;
154+
border-left: 4px solid var(--primary-color);
155+
background: var(--blockquote-bg);
119156
padding: 0.6em 1em;
120157
margin: 1.5em 0;
121-
color: #397DFF;
158+
color: var(--primary-color);
122159
font-style: italic;
160+
transition: background-color 0.3s ease;
123161
}
124162

125163
hr {
126164
border: none;
127-
border-top: 2px solid #e4ecfa;
165+
border-top: 2px solid var(--hr-color);
128166
margin: 3rem 0;
129167
}
130168

_sass/custom/custom.scss

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
flex-basis: 45%;
1111
padding: 0.75rem;
1212
margin-bottom: 0.75rem;
13-
border: 1px solid #e1e4e8;
13+
border: 1px solid var(--border-color);
1414
border-radius: 8px;
15-
background-color: #ffffff;
16-
transition: box-shadow 0.2s ease;
15+
background-color: var(--card-bg);
16+
transition: box-shadow 0.2s ease, background-color 0.3s ease, border-color 0.3s ease;
1717

1818
&:hover {
19-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
19+
box-shadow: 0 2px 8px var(--card-shadow);
2020
}
2121

2222
.person-image {
@@ -32,21 +32,22 @@
3232
margin: 0.25rem 0;
3333
font-size: 1rem;
3434
font-weight: 600;
35-
color: #24292e;
35+
color: var(--text-color);
3636

3737
a {
38-
color: #0366d6;
38+
color: var(--primary-color);
3939
text-decoration: none;
4040

4141
&:hover {
4242
text-decoration: underline;
43+
color: var(--primary-hover);
4344
}
4445
}
4546
}
4647

4748
.person-role {
4849
font-weight: 500;
49-
color: #0366d6;
50+
color: var(--primary-color);
5051
margin: 0.25rem 0;
5152
font-size: 0.9rem;
5253
}
@@ -89,6 +90,43 @@
8990
}
9091
}
9192

93+
/* Dark Mode Toggle Styles */
94+
.dark-mode-toggle-container {
95+
position: fixed;
96+
top: 20px;
97+
right: 20px;
98+
z-index: 1000;
99+
}
92100

93-
94-
101+
.dark-mode-toggle {
102+
background: var(--card-bg);
103+
border: 2px solid var(--border-color);
104+
border-radius: 50%;
105+
width: 50px;
106+
height: 50px;
107+
display: flex;
108+
align-items: center;
109+
justify-content: center;
110+
cursor: pointer;
111+
transition: all 0.3s ease;
112+
box-shadow: 0 2px 8px var(--card-shadow);
113+
color: var(--text-color);
114+
font-size: 1.2rem;
115+
116+
&:hover {
117+
transform: scale(1.1);
118+
box-shadow: 0 4px 12px var(--card-shadow);
119+
}
120+
121+
&:active {
122+
transform: scale(0.95);
123+
}
124+
125+
.toggle-icon {
126+
transition: transform 0.3s ease;
127+
}
128+
129+
&:hover .toggle-icon {
130+
transform: rotate(15deg);
131+
}
132+
}

docs/facilitators.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ nav_order: 4
44
layout: home
55
---
66

7+
{% include dark-mode-toggle.html %}
78

89
<style>
910
.role {
@@ -17,14 +18,14 @@ layout: home
1718
flex-basis: 45%;
1819
padding: 0.75rem;
1920
margin-bottom: 0.75rem;
20-
border: 1px solid #e1e4e8;
21+
border: 1px solid var(--border-color);
2122
border-radius: 8px;
22-
background-color: #ffffff;
23-
transition: box-shadow 0.2s ease;
23+
background-color: var(--card-bg);
24+
transition: box-shadow 0.2s ease, background-color 0.3s ease, border-color 0.3s ease;
2425
}
2526

2627
.person:hover {
27-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
28+
box-shadow: 0 2px 8px var(--card-shadow);
2829
}
2930

3031
.person-image {
@@ -40,21 +41,22 @@ layout: home
4041
margin: 0.25rem 0;
4142
font-size: 1rem;
4243
font-weight: 600;
43-
color: #397DFF;
44+
color: var(--primary-color);
4445
}
4546

4647
.person-name a {
47-
color: #397DFF;
48+
color: var(--primary-color);
4849
text-decoration: none;
4950
}
5051

5152
.person-name a:hover {
5253
text-decoration: underline;
54+
color: var(--primary-hover);
5355
}
5456

5557
.person-role {
5658
font-weight: 500;
57-
color: #397DFF;
59+
color: var(--primary-color);
5860
margin: 0.25rem 0;
5961
font-size: 0.9rem;
6062
}

docs/resources.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ nav_order: 3
44
layout: home
55
---
66

7+
{% include dark-mode-toggle.html %}
8+
79
# <span style="color: #397DFF; font-weight: 350">Additional Resources</span>
810

911
This page contains additional resources for each lecture to help you dive deeper into the topics covered.

docs/syllabus.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ nav_order: 2
44
layout: home
55
---
66

7+
{% include dark-mode-toggle.html %}
8+
79
# <span style="color: #397DFF; font-weight: 350">Syllabus</span>
810

911
## <span style="color: #397DFF">Course Format</span>

index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ nav_order: 1
44
layout: home
55
---
66

7+
{% include dark-mode-toggle.html %}
8+
79
# <span style="color: #397DFF; font-weight: 490;">CRUP Fall 2025</span>
810

911
Welcome to **Codebase's Ramp Up Program (CRUP)**! We will dive into **Software Engineering, Machine Learning, and AI** through hands-on work in **Python, Java,** and **SQL**, and frameworks like **PyTorch, scikit-learn, and more!**.

0 commit comments

Comments
 (0)