Skip to content

Crafting Interpreters Dark by MaxPlay

Details

AuthorMaxPlay

LicenseMIT

Categoryhttps://craftinginterpreters.com/

Created

Updated

Size2.2 kB

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

Dark Mode for the web version of Crafting Interpreters by Robert Nystrom

Notes

Crafting Interpreters Dark

Dark Mode for the web version of Crafting Interpreters by Robert Nystrom.

Remarks

This does not change the style of the main page, only for the files that are "the book".

Also, this uses filter: invert() for images to make them fit. This works, because all images in the book are in black and white. There is actually a joke about inverting images, so don't think the dark mode is broken when you reach these images (the negated muffin looks regular unfortunately).

Source code

/* ==UserStyle==
@name         Crafting Interpreters Dark
@version      20240706.16.02
@namespace    https://userstyles.world/user/MaxPlay
@description  Dark Mode for the web version of Crafting Interpreters by Robert Nystrom
@author       MaxPlay
@license      MIT
==/UserStyle== */

@-moz-document regexp("((https?:\\/\\/)?craftinginterpreters\\.com\\/).+(\\.html)*") {
article img {
  filter: invert(0.87);
}

body {
  color: #fff;
  background: #222;
}

a {
  color: #1bb2ff;
}

a:hover {
  color: #68ccff;
}

article.chapter h2 a,
article.chapter h3 a {
  color: #cacaca;
}

code {
  color: #cdcdcd;
}

.codehilite {
  color: #fff;
  background: #111;
}

.codehilite pre {
  color: #cabdbd;
}
.codehilite .k {
  color: #0099e6;
}
.codehilite .n {
  color: #dd713c;
}
.codehilite .s {
  color: #ffae0b;
}
.codehilite .e {
  color: #e8ba30;
}
.codehilite .c {
  color: #d0ceca;
}
.codehilite .a {
  color: #9966cc;
}
.codehilite .i {
  color: #70cfff;
}
.codehilite .t {
  color: #42e5d3;
}
.codehilite .insert {
  background: #050505;
}
.codehilite .delete {
  background: repeating-linear-gradient(-45deg, #333, #333 2px, rgba(0, 0, 0, 0) 1px, rgba(0, 0, 0, 0) 6px);
}
.codehilite .delete span {
  color: #bab8b7;
}
.codehilite .insert-before,
.codehilite .insert-after {
  color: #bab8b7;
}
.codehilite .insert-before .insert-comma {
  background: #050505;
  color: #eee;
}
article.chapter .challenges,
article.chapter .design-note {
  background: #333;
  color: #fff;
}

article.chapter .challenges aside code,
article.chapter .challenges aside .codehilite,
article.chapter .design-note aside code,
article.chapter .design-note aside .codehilite {
  color: #fff;
  background: #111;
}

article.chapter .challenges {
  background: #060606;
}
article.chapter .challenges code,
article.chapter .challenges .codehilite {
  background: #2b2b2b;
}
article.chapter .design-note {
  background: #060606;
}
article.chapter .design-note code,
article.chapter .design-note .codehilite {
  background: #000;
}
footer {
  color: #d2ebec;
}
footer .next {
  background: #222;
}
footer .next:hover {
  color: #68ccff;
}
blockquote p {
  color: #62bbff;
}
blockquote cite {
  color: #9bceef;
}
}

Reviews

No reviews yet.