Skip to content

Commit 4948437

Browse files
alichraghiStephen Gutekanst
authored andcommitted
automatic light/dark theme
1 parent 084928b commit 4948437

8 files changed

+99
-47
lines changed

assets/main.scss

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ html, body {
44
margin: 0;
55
padding: 0;
66

7-
background: #0f0f0f;
8-
color: #ccc;
7+
background: white;
8+
color: #0f0f0f;
99
font-family: Orbitron;
1010
line-height: 1.3;
11+
12+
@media (prefers-color-scheme: dark) {
13+
background: #0f0f0f;
14+
color: #ccc;
15+
}
1116
}
1217
body {
1318
display: flex;
@@ -28,7 +33,11 @@ a, a:hover, a:visited {
2833
color: #c18004;
2934
}
3035
blockquote {
31-
color: grey;
36+
color: #646464;
37+
38+
@media (prefers-color-scheme: dark) {
39+
color: grey;
40+
}
3241
}
3342

3443
h1,h2,h3,h4,h5,h6 {
@@ -46,6 +55,18 @@ p {
4655
filter: invert(100%);
4756
}
4857

58+
.color-auto {
59+
@media (prefers-color-scheme: dark) {
60+
filter: invert(100%);
61+
}
62+
}
63+
64+
.color-auto-light {
65+
@media (prefers-color-scheme: light) {
66+
filter: invert(100%);
67+
}
68+
}
69+
4970
.navbar {
5071
.content {
5172
display: flex;
@@ -69,11 +90,11 @@ p {
6990
text-decoration: none;
7091
}
7192
.logo, .logo:hover, .logo:visited {
72-
color: #d7d7d7 !important;
93+
color: #7a7a7a !important;
7394
}
7495
.logo>img {
7596
vertical-align: middle;
76-
filter: invert(100%);
97+
@extend .color-auto;
7798
height: 30px;
7899
}
79100
&>div>a {
@@ -83,7 +104,11 @@ p {
83104
padding-right: 1rem;
84105
padding-left: 1rem;
85106
&:hover, &:active {
86-
background: #515151;
107+
background: #ccc;
108+
109+
@media (prefers-color-scheme: dark) {
110+
background: #515151;
111+
}
87112
}
88113
}
89114
}
@@ -174,9 +199,13 @@ main {
174199
}
175200

176201
article>.title>a {
177-
color: #ccc;
202+
color: #0f0f0f;
178203
font-size: 36px;
179204
text-decoration: none;
205+
206+
@media (prefers-color-scheme: dark) {
207+
color: #ccc;
208+
}
180209
}
181210
article>.title>a:hover {
182211
color: #c18004;
@@ -188,11 +217,19 @@ article .description {
188217
padding-bottom: 0.5rem;
189218
}
190219
article .description, p {
191-
color: #ccc;
220+
color: #0f0f0f;
221+
222+
@media (prefers-color-scheme: dark) {
223+
color: #ccc;
224+
}
192225
}
193226
article>.post-footer {
194-
color: #b4b4b4;
227+
color: #6d6d6d;
195228
font-size: 14px;
229+
230+
@media (prefers-color-scheme: dark) {
231+
color: #b4b4b4;
232+
}
196233
}
197234
article .category {
198235
text-decoration: none;
@@ -246,8 +283,12 @@ article .category:hover {
246283
margin-top: 1rem;
247284
}
248285
.single>.header .metadata {
249-
color: #b4b4b4;
286+
color: #6d6d6d;
250287
font-size: 14px;
288+
289+
@media (prefers-color-scheme: dark) {
290+
color: #b4b4b4;
291+
}
251292
}
252293
.hanchor {
253294
text-decoration: none;
@@ -257,12 +298,15 @@ code {
257298
text-align: left;
258299
border-radius: 4px;
259300
font-size: 14px;
260-
padding: 0.15rem;
261301
padding-left: 0.3rem;
262302
padding-right: 0.3rem;
263303

264-
background: black;
304+
background: white;
265305
border: 1px solid #3b3c38;
306+
307+
@media (prefers-color-scheme: dark) {
308+
background: black;
309+
}
266310
}
267311
h2>code {
268312
font-size: unset;
@@ -292,6 +336,10 @@ pre {
292336
background: black !important;
293337
overflow: auto;
294338
border: 1px solid #3b3c38;
339+
340+
@media (prefers-color-scheme: light) {
341+
color: white;
342+
}
295343
}
296344
details {
297345
margin-top: 1rem;
@@ -346,7 +394,11 @@ td, th {
346394
padding: 0.5rem;
347395
}
348396
tr:nth-child(even) {
349-
background: #3b3c38;
397+
background: white;
398+
399+
@media (prefers-color-scheme: dark) {
400+
background: #3b3c38;
401+
}
350402
}
351403
th {
352404
padding-top: 1rem;

content/2021/mach-engine-the-future-of-graphics-with-zig.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ In the coming months, we'll begin to have truly cross-platform low-level graphic
1616

1717
## Mach engine
1818

19-
<img class="color-inverted" alt="Mach: Game engine & graphics toolkit for the future" src="https://user-images.githubusercontent.com/3173176/137651926-3734c3b2-4875-47de-b42f-0ece854756f7.png">
19+
<img class="color-auto" alt="Mach: Game engine & graphics toolkit for the future" src="https://user-images.githubusercontent.com/3173176/137651926-3734c3b2-4875-47de-b42f-0ece854756f7.png">
2020

2121
I've been working on [Mach Engine](https://github.com/hexops/mach) for about 4 months now, although it as a project is many years in the making, and I believe in the next 4-6 months we'll have completion of the first key milestone: truly cross platform graphics and seamless cross compilation.
2222

2323
## Vision
2424

2525
Today, I share only the first milestone: Mach engine core. I've been working on this for around 1 year now, and we're close (maybe 4-6 months away) from completion:
2626

27-
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137649720-072ff7fe-323d-49c6-ae88-51344e04e3e5.png"><img class="color-inverted" alt="Zero fuss installation, out of the box cross compilation, and a truly cross-platform graphics API" src="https://user-images.githubusercontent.com/3173176/137649720-072ff7fe-323d-49c6-ae88-51344e04e3e5.png"></a>
27+
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137649720-072ff7fe-323d-49c6-ae88-51344e04e3e5.png"><img class="color-auto" alt="Zero fuss installation, out of the box cross compilation, and a truly cross-platform graphics API" src="https://user-images.githubusercontent.com/3173176/137649720-072ff7fe-323d-49c6-ae88-51344e04e3e5.png"></a>
2828

2929
## Zero fuss installation & cross compilation
3030

@@ -41,15 +41,15 @@ We're able to achieve this thanks to two things:
4141

4242
Imagine a low-level, little to no overhead graphics API that unifies DirectX, Metal, Vulkan, and OpenGL (if no others are available):
4343

44-
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137646296-72ba698e-c710-4daf-aa75-222f8d717d00.png"><img class="color-inverted" alt="Simple, low-level unified graphics API mapping to DirectX 12, Metal, Vulkan, and OpenGL" src="https://user-images.githubusercontent.com/3173176/137646296-72ba698e-c710-4daf-aa75-222f8d717d00.png"></a>
44+
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137646296-72ba698e-c710-4daf-aa75-222f8d717d00.png"><img class="color-auto" alt="Simple, low-level unified graphics API mapping to DirectX 12, Metal, Vulkan, and OpenGL" src="https://user-images.githubusercontent.com/3173176/137646296-72ba698e-c710-4daf-aa75-222f8d717d00.png"></a>
4545

4646
_This isn't anything new:_ all modern engines provide this, Godot has been working towards this for _years_ (and still is), and there exist abstraction layers for Vulkan over most of these APIs as well.
4747

4848
### Vendor support
4949

5050
**An API is only as good as the momentum behind it.** What modern API can target the largest array of platforms with the most vendor backing?
5151

52-
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137647361-3340e33a-9b2f-4c0d-aba5-6bb99ffd1cd8.png"><img class="color-inverted" alt="Google to Vulkan, Microsoft to DirectX, Apple to Metal, AMD and NVidia to everything." src="https://user-images.githubusercontent.com/3173176/137647361-3340e33a-9b2f-4c0d-aba5-6bb99ffd1cd8.png"></a>
52+
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137647361-3340e33a-9b2f-4c0d-aba5-6bb99ffd1cd8.png"><img class="color-auto" alt="Google to Vulkan, Microsoft to DirectX, Apple to Metal, AMD and NVidia to everything." src="https://user-images.githubusercontent.com/3173176/137647361-3340e33a-9b2f-4c0d-aba5-6bb99ffd1cd8.png"></a>
5353

5454
* **Microsoft sees DirectX as the future, not Vulkan.** (DirectX 13 is coming by the end of 2022.)
5555
* **Apple sees Metal as the future, not Vulkan.** OpenGL and OpenCL are deprecated, and private legal arguments with Khoronos make it unlikely we'll ever see OpenGL or Vulkan on Apple hardware ever again.
@@ -58,7 +58,7 @@ _This isn't anything new:_ all modern engines provide this, Godot has been worki
5858

5959
### One API that Apple, Microsoft, and Google can all agree on
6060

61-
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137647342-abf2bde6-a8bb-4276-b072-95c279c5d92f.png"><img class="color-inverted" alt="Mozilla, Google, Microsoft, Apple, and Intel all to WebGPU" src="https://user-images.githubusercontent.com/3173176/137647342-abf2bde6-a8bb-4276-b072-95c279c5d92f.png"></a>
61+
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137647342-abf2bde6-a8bb-4276-b072-95c279c5d92f.png"><img class="color-auto" alt="Mozilla, Google, Microsoft, Apple, and Intel all to WebGPU" src="https://user-images.githubusercontent.com/3173176/137647342-abf2bde6-a8bb-4276-b072-95c279c5d92f.png"></a>
6262

6363
Outside the bounds of traditional graphics APIs there exists an attempt to provide a unified API across all platforms, [WebGPU](https://en.wikipedia.org/wiki/WebGPU) (not to be confused with the much older _WebGL_).
6464

@@ -68,7 +68,7 @@ The name _WebGPU_ might lead you to believe that this is only for browsers, and
6868

6969
### Apple & Google's role is what makes WebGPU unique, and why we chose it
7070

71-
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137648560-e15820d7-6427-4ebd-95bb-c7c9f026477a.png"><img class="color-inverted" alt="Khronos group out of the piture in the future" src="https://user-images.githubusercontent.com/3173176/137648560-e15820d7-6427-4ebd-95bb-c7c9f026477a.png"></a>
71+
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137648560-e15820d7-6427-4ebd-95bb-c7c9f026477a.png"><img class="color-auto" alt="Khronos group out of the piture in the future" src="https://user-images.githubusercontent.com/3173176/137648560-e15820d7-6427-4ebd-95bb-c7c9f026477a.png"></a>
7272

7373
What is new about WebGPU in my view is the vendors playing key roles in its development, and the fact that it grew outside the Khronos Group.
7474

@@ -121,7 +121,7 @@ Although abstraction layers over modern graphics APIs are nothing new - as Apple
121121

122122
Today, we have cross-compilation of GLFW on all desktop OSs working out of the box with nothing more than `zig` and `git`:
123123

124-
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137650099-cd370046-eb43-4fe4-a72a-f54ebe3153c1.png"><img class="color-inverted" alt="Cross compilation from Mac, Linux, and Windows to eachother on all major architectures." src="https://user-images.githubusercontent.com/3173176/137650099-cd370046-eb43-4fe4-a72a-f54ebe3153c1.png"></a>
124+
<a class="imglink" href="https://user-images.githubusercontent.com/3173176/137650099-cd370046-eb43-4fe4-a72a-f54ebe3153c1.png"><img class="color-auto" alt="Cross compilation from Mac, Linux, and Windows to eachother on all major architectures." src="https://user-images.githubusercontent.com/3173176/137650099-cd370046-eb43-4fe4-a72a-f54ebe3153c1.png"></a>
125125

126126
This involved:
127127

content/2021/terrifying-parallels-between-tech-and-aerospace.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Software engineering is one of the most lucrative careers of our era. Most in ou
2121

2222
The sheer scale of money pouring into SV and other tech hubs worldwide is unfathomable even to many making six-figure salaries in tech, there is more money than there are good ideas-and it shows (looking at you, [Juicera](https://www.juicera.com/).)
2323

24-
<img class="color-inverted" src="https://user-images.githubusercontent.com/3173176/142679500-29ebcaf2-9d57-4dad-8e35-c1a60bffd793.png">
24+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/142679500-29ebcaf2-9d57-4dad-8e35-c1a60bffd793.png">
2525

2626
## How the aviation industry eerily reflects the tech industry
2727

@@ -33,11 +33,11 @@ This industry-wide push came about because the aerospace industry realized their
3333

3434
If you think Boeing’s 747 MAX disaster was the downfall of the aerospace industry, you need to think again. There are things you’re not going to find in the news that happened much earlier according to people that were there.
3535

36-
<img class="color-inverted" src="https://user-images.githubusercontent.com/3173176/142681033-f26e31ea-8384-4034-83e0-17c293c10422.png">
36+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/142681033-f26e31ea-8384-4034-83e0-17c293c10422.png">
3737

3838
(Despite my mother’s internship being 30 years ago, she is still hesitant to publicly name the company involved and at her request I redacted the name.)
3939

40-
<img class="color-inverted" src="https://user-images.githubusercontent.com/3173176/142681141-eabbdae3-8f3d-4af4-be8a-1d88a81f1e5e.png">
40+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/142681141-eabbdae3-8f3d-4af4-be8a-1d88a81f1e5e.png">
4141

4242
The stress my father’s job imposed upon him changed him (or rather, brought out another side of him.) Most of my memories with him involved verbal and heavily emotional fights, as well as arguments between him, myself, and family members. Most of the time I spent with him in public, he was making some poor customer service worker’s life a living hell (and he enjoyed it.)
4343

@@ -51,7 +51,7 @@ When I look at the state of the tech industry today and see pushes for location-
5151

5252
## Have we reached a plateau?
5353

54-
<img class="color-inverted" src="https://user-images.githubusercontent.com/3173176/142683055-c24a21ce-542a-400f-9c5a-04188d8d31e2.png">
54+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/142683055-c24a21ce-542a-400f-9c5a-04188d8d31e2.png">
5555

5656
Major economic forces have been pushing the idea that everyone should learn to code for many, many years now, [Gates and Zuckerberg were pushing the idea that every child should learn to code back in 2013](https://www.cnn.com/2013/02/27/tech/innovation/code-video-gates-zuckerberg/index.html) and likely long before that. (Awkward disclaimer, my day job is at a startup focused on this too)
5757

@@ -69,7 +69,7 @@ We have a representation of what being a coder could look like in the future: th
6969

7070
The future of being a coder, I think, looks an awful lot like being a game developer looks like today.
7171

72-
<img class="color-inverted" src="https://user-images.githubusercontent.com/3173176/142684131-097dbaa9-1843-4aa6-aacf-5089600bbb0f.png">
72+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/142684131-097dbaa9-1843-4aa6-aacf-5089600bbb0f.png">
7373

7474
Enter a behemoth organization and hope to achieve anything noteworthy among the swaths of so many other coders that your contributions are nearly worthless, or go to a smaller company because you are young, bubbly-eyed, and believe there is a family to be had there all while it being demanded you achieve unreasonable amounts of work with a high likelihood that the company fails in the end. You get to choose. You wish you could go at it alone, you have dreams and aspirations of doing just that, but you need to pay the bills somehow. Perhaps you’re just out of school, and so you manage Active Directory for a company instead.
7575

@@ -79,15 +79,15 @@ Maybe you do have a truly good idea, but you don’t have access to investors an
7979

8080
The squashing of independent ideas and independent business models creates opportunities for monopolistic enterprises to effectively _own people_ and _own their success_ while divesting risk fully to individuals.
8181

82-
<img class="color-inverted" src="https://user-images.githubusercontent.com/3173176/142683218-8f4949aa-7937-4e58-b2bc-5862ae68b2fa.png">
82+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/142683218-8f4949aa-7937-4e58-b2bc-5862ae68b2fa.png">
8383

8484
Once the plateau for any of these markets is reached (or if platforms realize that we’re not going to see a winner-take-all market for that area?), then profit extraction should begin and we will see middlemen shift to maximal extraction of taxes from their platform while producers only begin to realize how minute they have become. New platforms will appear, such as the YouTube competitors pushed by creators today, but they’ll mostly be in-vain attempts to regain some control of the customers they now realize they have no untaxed access to.
8585

8686
This approach of tech business is accelerating. When we hear “every company is becoming a tech company”, this is a core model being described and it’s not fundamentally different from the outsourcing of manufacturing jobs to third-world countries we did historically-the only difference is we’re seeing the outsourcing the production of _everything_ and instead of it being cheaper because we avoid safety regulations, it’s cheaper because individuals who are their own “companies” and are forced to assume all risk of producing new things or lose out on the market entirely. Reward must be divested to the platform they are beholden to.
8787

8888
## Does capitalism necessarily have to be bad for society?
8989

90-
<img class="color-inverted" src="https://user-images.githubusercontent.com/3173176/142684228-bf1d41e5-ca25-4497-978c-d82c29c7682e.png">
90+
<img class="color-auto" src="https://user-images.githubusercontent.com/3173176/142684228-bf1d41e5-ca25-4497-978c-d82c29c7682e.png">
9191

9292
At this point, you probably think I hold deeply anti-capitalistic views. I don’t, I hold more nuanced views than that. But I do despise the monopolistic tendencies of corporations. It’s the lack of distributed opportunity within a capitalist society that I believe is bad.
9393

0 commit comments

Comments
 (0)