orangeduck / BuildYourOwnLisp

Learn C and build your own programming language in under 1000 lines of code!
http://www.buildyourownlisp.com/
Other
2.84k stars 392 forks source link

Add "dark mode" colour scheme #171

Open twome opened 1 year ago

twome commented 1 year ago

This adds a "dark" (light text on dark background) alternate colour scheme for readers like me who get very sore eyes 🥲.

Caveat: this currently depends upon the user's browser/OS "dark mode / light mode" setting via CSS media query (i.e. it defaults to the current light scheme). I plan to make an unobtrusive toggle mode button (sequestered to a branch for now), but I'm just starting this PR tentatively now regardless.

I've had a quick look through every chapter and can't see any glaring layout issues. Bootstrap's CSS selectors can be very convoluted and high-specificity, so content changes that do a bunch of weird container nesting could conceivably break something - but likely would do so anyway.

My main focus was on the book content so I still need to do a quick pass of the auxiliary pages.

I'm not wedded to any of the colour choices; feel free to change whatever there. I tried to follow the spirit and palette, but the dark scheme feels a little more "brown" than "beige/manila". I was quite careful to retain the semantic meaning of the syntax highlighting colours in particular, but I haven't checked every section for CSS selectors squashing each other inappropriately/confusingly.

I have ~zero image editing skills so my crudely-darkened background pattern could do with a bit more subtlety. I cleaned up the cute tiled roof header a little; unfortunately it still sticks out a bit on the dark background.

The two biggest changes are the body content width, which is now defined in em values, and pumping up the 13-14px font size to 16px, which is obviously an opinionated change but I really think it's a good default for more relaxed reading (and scaling with browser zoom should stay proportional / look nice).

Regardless of acceptance, thanks for the wonderful book!

2022-07-18 00_33_27 screenshot

2022-07-18 00_34_29 screenshot

orangeduck commented 1 year ago

Thanks Tom - this is really cool - I will try to take a look some time next week!