Skip to content

Commit 6589017

Browse files
committed
Squashed commit of the following:
commit 2374942 Author: Peter Parente <[email protected]> Date: Sat Jan 4 15:15:43 2025 -0500 Fix mdash, typo in observability post commit 5767d33 Author: Peter Parente <[email protected]> Date: Sat Jan 4 15:15:25 2025 -0500 Support system light/dark mode
1 parent b33076b commit 6589017

File tree

6 files changed

+161
-12
lines changed

6 files changed

+161
-12
lines changed

pages/20250101-software-observability-roundup/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ should head. Shared terminology and goals are works in progress.
118118
at correlating and summarizing[^burmistrov2024], perhaps continually in the
119119
background.[^tane2024dec]
120120

121-
- Adopt tooling that lets you explore quickly and cheaply--to discover emergent behaviors, answer
122-
new questions, prepare for unknown unknowns.
121+
- Adopt tooling that lets you explore quickly and cheaply&mdash;to discover emergent behaviors,
122+
answer new questions, prepare for unknown unknowns.
123123

124124
- Proper tooling allows engineers to investigate any system, regardless of their experience
125125
with it or its complexity, in a methodical and objective manner.[^majors2022]
@@ -128,7 +128,7 @@ should head. Shared terminology and goals are works in progress.
128128
- You will never ask the same question twice. Something is different since you last asked
129129
it.[^weakly2024mar]
130130
- There is a natural tension between a system’s scalability and its feature set. You can
131-
afford much powerful observability features at scales orders of magnitude smaller than
131+
afford more powerful observability features at scales orders of magnitude smaller than
132132
Google.[^sigelman2021a]
133133

134134
# Looking Forward

static/css/notebook.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* Light mode theme default */
12
.anchor-link {
23
display: none;
34
}
@@ -64,4 +65,25 @@
6465

6566
.output_html {
6667
overflow-x: auto;
68+
}
69+
70+
/* Dark mode theme alternative */
71+
@media (prefers-color-scheme: dark) {
72+
.input_prompt {
73+
color: #7f9fff;
74+
}
75+
76+
.output_prompt {
77+
color: #ff7f7f;
78+
}
79+
80+
.input_area pre {
81+
background-color: #2a2e2c;
82+
}
83+
84+
.output_subarea td,
85+
.output_subarea th,
86+
.output_subarea table {
87+
border-color: #444;
88+
}
6789
}

static/css/pygments.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* Light mode theme default */
12
.hll { background-color: #ffffcc }
23
.c { color: #408080; font-style: italic } /* Comment */
34
.err { border: 1px solid #FF0000 } /* Error */
@@ -59,3 +60,50 @@
5960
.vg { color: #19177C } /* Name.Variable.Global */
6061
.vi { color: #19177C } /* Name.Variable.Instance */
6162
.il { color: #666666 } /* Literal.Number.Integer.Long */
63+
64+
/* Dark mode theme alternative */
65+
@media (prefers-color-scheme: dark) {
66+
.hll { background-color: #3f3f2c }
67+
.c { color: #8ec2c2; font-style: italic }
68+
.err { border: 1px solid #ff5555 }
69+
.k { color: #7fbf7f; font-weight: bold }
70+
.o { color: #999999 }
71+
.cm, .cp, .c1, .cs { color: #8ec2c2; font-style: italic }
72+
.gd { color: #ff7f7f }
73+
.gh { color: #7f9fff; font-weight: bold }
74+
.gi { color: #7fbf7f }
75+
.go { color: #888888 }
76+
.gp { color: #7f9fff; font-weight: bold }
77+
.gu { color: #bf7fbf; font-weight: bold }
78+
.gt { color: #7f9fff }
79+
.kc, .kd, .kn, .kr { color: #7fbf7f; font-weight: bold }
80+
.kp { color: #7fbf7f }
81+
.kt { color: #ff7f9f }
82+
.m { color: #999999 }
83+
.s { color: #ff9f9f }
84+
.na { color: #bfbf7f }
85+
.nb { color: #7fbf7f }
86+
.nc { color: #7f9fff; font-weight: bold }
87+
.no { color: #ff9f9f }
88+
.nd { color: #bf7fff }
89+
.ni { color: #cfcfcf; font-weight: bold }
90+
.ne { color: #ff7f7f; font-weight: bold }
91+
.nf { color: #7f9fff }
92+
.nl { color: #bfbf7f }
93+
.nn { color: #7f9fff; font-weight: bold }
94+
.nt { color: #7fbf7f; font-weight: bold }
95+
.nv { color: #9f9fff }
96+
.w { color: #666666 }
97+
.mf, .mh, .mi, .mo { color: #999999 }
98+
.sb, .sc, .sd, .s2 { color: #ff9f9f }
99+
.se { color: #ffaf7f; font-weight: bold }
100+
.sh { color: #ff9f9f }
101+
.si { color: #ff9fbf; font-weight: bold }
102+
.sx { color: #7fbf7f }
103+
.sr { color: #ff9fbf }
104+
.s1 { color: #ff9f9f }
105+
.ss { color: #9f9fff }
106+
.bp { color: #7fbf7f }
107+
.vc, .vg, .vi { color: #9f9fff }
108+
.il { color: #999999 }
109+
}

static/css/site.css

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* Light mode theme default */
12
:root {
23
--bs-code-color: #338866;
34
}
@@ -228,12 +229,63 @@ body .gist {
228229
margin-bottom: 30px;
229230
}
230231

231-
.container{
232+
.container {
232233
max-width:980px !important;
233234
}
234235

235236
img {
236237
max-width: 100%;
237238
height: auto;
238239
border: 1px solid #ccc;
240+
}
241+
242+
/* Dark mode theme alternative */
243+
@media (prefers-color-scheme: dark) {
244+
body {
245+
background-color: #1a1d1b;
246+
color: #e0e0e0;
247+
}
248+
249+
h1,h2,h3,h4,h5,h6 {
250+
color: #e0e0e0;
251+
}
252+
253+
a, a:visited, a:hover {
254+
color: #6ba5bf;
255+
}
256+
257+
.archiveList .yearBreak .year {
258+
color: #e0e0e0;
259+
}
260+
261+
pre {
262+
background-color: #2a2e2c;
263+
border-color: #444;
264+
}
265+
266+
.footerSection {
267+
border-color: #444;
268+
}
269+
270+
.footnote li:target {
271+
background-color: #2d4d41;
272+
}
273+
274+
img, .profilePic, .bordered {
275+
border-color: #444;
276+
}
277+
278+
.pageTitle {
279+
border-color: #444;
280+
color: #5fcfa3;
281+
}
282+
283+
.pageDate, .archiveList .date, .commentary {
284+
color: #888;
285+
}
286+
287+
.embedFilename {
288+
color: #5fcfa3;
289+
border-color: #444;
290+
}
239291
}

static/js/comments.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
(function() {
2+
// Configure script dynamically so the theme can be set based on user system preference
3+
const utterancesScript = document.createElement('script');
4+
utterancesScript.src = 'https://utteranc.es/client.js';
5+
utterancesScript.setAttribute('repo', 'parente/blog');
6+
utterancesScript.setAttribute('issue-term', "[${page['slug']}]");
7+
utterancesScript.setAttribute('crossorigin', 'anonymous');
8+
utterancesScript.setAttribute('async', '');
9+
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
10+
utterancesScript.setAttribute('theme', 'github-dark');
11+
} else {
12+
utterancesScript.setAttribute('theme', 'github-light');
13+
}
14+
// Insert the configured script into the DOM
15+
document.getElementById('userComments').appendChild(utterancesScript);
16+
17+
// Listen for color scheme preference changes
18+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
19+
const theme = e.matches ? 'github-dark' : 'github-light';
20+
const iframe = document.querySelector('.utterances-frame');
21+
// Reload the iframe to change the theme to match. Utterances supports a 'set-theme'
22+
// postMessage. However, tracking if the iframe has been added to the page by the initial
23+
// script in order to listen for whether the iframe has loaded lazily or not yet to decide
24+
// whether to postMessage or to update src involves more JS than I care to maintain for
25+
// this edge case. I accept the brief flicker of the iframe reloading.
26+
if(iframe) {
27+
const url = new URL(iframe.src);
28+
const searchParams = new URLSearchParams(url.search);
29+
searchParams.set('theme', theme);
30+
url.search = searchParams.toString();
31+
iframe.src = url.toString();
32+
}
33+
});
34+
})();

templates/page.mako

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@
2323
<%block name="pageMeta">
2424
% if page['allow_comments']:
2525
<div class="footerSection" id="userComments">
26-
<script src="https://utteranc.es/client.js"
27-
repo="parente/blog"
28-
issue-term="[${page['slug']}]"
29-
label="thread"
30-
theme="github-light"
31-
crossorigin="anonymous"
32-
async>
33-
</script>
26+
<script src="${site_root}/static/js/comments.js" async></script>
3427
</div>
3528
% endif
3629
% if 'next' in page:

0 commit comments

Comments
 (0)