Skip to content

Instantly share code, notes, and snippets.

@JaimeStill
Last active August 15, 2025 12:53
Show Gist options
  • Save JaimeStill/d330d8512dc445ccfbf351c9b4207b68 to your computer and use it in GitHub Desktop.
Save JaimeStill/d330d8512dc445ccfbf351c9b4207b68 to your computer and use it in GitHub Desktop.
CSS variant for the Let's Go web book adding dark mode support and using system fonts.
:root {
/* Text Width */
--text-width: 860px;
/* Typography */
--main-font: system-ui, sans-serif;
--code-font:
ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
"DejaVu Sans Mono", monospace;
/* Text Colors */
--text-primary: #283c46;
--text-muted: #818181;
--link-color: #007bb6;
/* Background Colors */
--bg-contrast: #f9f9f9;
--bg: #ffffff;
/* Borders */
--border-color: #ededed;
/* Code Syntax Highlighting */
--code-keyword: #a82255;
--code-string: #008075;
--code-number: #5642a6;
/* Aside Backgrounds */
--bg-important: #fbf4f7;
--bg-note: #f2f8fb;
--bg-hint: #f2f9f8;
/* Miscellaneous */
--silver: silver;
}
/* Dark mode - inverted lightness */
@media (prefers-color-scheme: dark) {
:root {
/* Text Colors */
--text-primary: #d7e3ec;
--text-muted: #9e9e9e;
--link-color: #4da6db;
/* Background Colors */
--bg-contrast: #1a1a1a;
--bg: #0a0a0a;
/* Borders */
--border-color: #333333;
/* Code Syntax Highlighting */
--code-keyword: #e85b88;
--code-string: #4db8a8;
--code-number: #9b8dd9;
/* Aside Backgrounds */
--bg-important: #2a1f24;
--bg-note: #1a2428;
--bg-hint: #1a2827;
/* Miscellaneous */
--silver: #606060;
}
}
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document ========================================================================== */
/* 1. Correct the line height in all browsers. 2. Prevent adjustments of font size after orientation changes in iOS. */
html {
line-height: 1.15; /* 1 */
text-size-adjust: 100%; /* 2 */
}
/* Sections ========================================================================== */
/* Remove the margin in all browsers. */
body {
margin: 0;
}
/* Render the `main` element consistently in IE. */
main {
display: block;
}
/* Correct the font size and margin on `h1` elements within `section` and `article` contexts in Chrome, Firefox, and Safari. */
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content ========================================================================== */
/* 1. Add the correct box sizing in Firefox. 2. Show the overflow in Edge and IE. */
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/* 1. Correct the inheritance and scaling of font size in all browsers. 2. Correct the odd `em` font sizing in all browsers. */
pre {
font-family: var(--code-font); /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics ========================================================================== */
/* Remove the gray background on active links in IE 10. */
a {
background-color: transparent;
}
/* 1. Remove the bottom border in Chrome 57- 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. */
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/* Add the correct font weight in Chrome, Edge, and Safari. */
b,
strong {
font-weight: bolder;
}
/* 1. Correct the inheritance and scaling of font size in all browsers. 2. Correct the odd `em` font sizing in all browsers. */
code,
kbd,
samp {
font-family: var(--code-font); /* 1 */
font-size: 1em; /* 2 */
}
/* Add the correct font size in all browsers. */
small {
font-size: 80%;
}
/* Prevent `sub` and `sup` elements from affecting the line height in all browsers. */
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content ========================================================================== */
/* Remove the border on images inside links in IE 10. */
img {
border-style: none;
}
/* Forms ========================================================================== */
/* 1. Change the font styles in all browsers. 2. Remove the margin in Firefox and Safari. */
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/* Show the overflow in IE. 1. Show the overflow in Edge. */
button,
input {
/* 1 */
overflow: visible;
}
button,
select {
/* 1 */
text-transform: none;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
appearance: button;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
fieldset {
padding: 0.35em 0.75em 0.625em;
}
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
progress {
vertical-align: baseline;
}
textarea {
overflow: auto;
}
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
[type="number"]::inner-spin-button,
[type="number"]::outer-spin-button {
height: auto;
}
[type="search"] {
appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
[type="search"]::search-decoration {
appearance: none;
}
::file-upload-button {
appearance: button; /* 1 */
font: inherit; /* 2 */
}
details {
display: block;
}
summary {
display: list-item;
}
template {
display: none;
}
[hidden] {
display: none;
}
html,
body,
p,
ol,
ul,
li,
dl,
dt,
dd,
blockquote,
figure,
fieldset,
legend,
textarea,
pre,
iframe,
hr,
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
padding: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 100%;
font-weight: normal;
}
ul {
list-style: none;
}
button,
input,
select,
textarea {
margin: 0;
}
html {
box-sizing: border-box;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
img,
embed,
iframe,
object,
audio,
video {
height: auto;
max-width: 100%;
}
iframe {
border: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
text-align: left;
}
img {
vertical-align: middle;
}
/*rgba(0,0,0,0.0235)*/
/*Used for .bash samp*/
body {
font-family: var(--main-font);
font-size: 20px;
line-height: 1.5;
color: var(--text-primary);
background-color: var(--bg);
}
a,
a:visited {
color: var(--link-color);
text-decoration: none;
}
a:hover,
a:visited:hover {
text-decoration: underline;
}
h1#front-matter {
display: none;
}
/*contents*/
nav ol li {
font-weight: 700;
list-style-type: disc;
}
nav ol li.indent {
font-weight: 400;
margin-left: 24px;
list-style-type: circle;
}
.text code,
.text table,
.text pre,
.text samp,
.text figcaption {
font-family: var(--code-font);
}
.text blockquote {
font-style: italic;
border-left: solid 4px var(--border-color);
padding-left: 1em;
}
.text blockquote code {
font-style: normal;
}
.text figure.code {
font-size: 16px;
background-color: var(--bg-contrast);
border: solid 1px var(--border-color);
overflow-x: auto;
}
.text figure.code figcaption {
padding: 14px 1em;
border-bottom: solid 1px var(--border-color);
margin-bottom: -3px;
}
.text figure.code pre {
padding: 1em;
tab-size: 4;
-moz-tab-size: 4;
-o-tab-size: 4;
}
.text figure.bash {
background-color: var(--text-primary);
color: var(--bg);
border: none;
}
.text figure.bash samp {
color: var(--silver);
}
.text figure,
.text table {
margin: 30px 0;
}
.text p,
.text ul,
.text ol,
.text aside {
margin: 20px 0;
}
.text em code {
font-style: normal;
}
.text h1,
.text h2 {
font-weight: 700;
font-size: 45px;
border-bottom: solid 1px var(--border-color);
padding-bottom: 15px;
margin-bottom: 30px;
}
.text h3 {
font-weight: 700;
font-size: 30px;
margin: 45px 0 20px;
}
.text h4 {
font-weight: 700;
font-size: 22px;
margin: 30px 0 20px;
}
.text h3 + h4 {
margin-top: 20px;
}
.text table {
width: 100%;
}
.text ul,
.text ol {
padding-left: 1em;
}
.text ul li,
.text ol li {
padding-left: 0.25em;
}
.text ul {
list-style-type: disc;
}
.text li + li {
margin-top: 5px;
}
.text code {
color: var(--code-keyword);
font-size: 19px;
padding: 0px 1px;
white-space: nowrap;
}
.text a code {
color: var(--link-color);
}
.text figure.img {
border: solid 1px var(--border-color);
box-shadow: 1px 1px 2px 0px var(--border-color);
-moz-box-shadow: 1px 1px 2px 0px var(--border-color);
box-shadow: 1px 1px 2px 0px var(--border-color);
}
.text aside {
padding: 1px 1em;
border-left-style: solid;
border-left-width: 6px;
}
.text aside.important {
background-color: var(--bg-important);
border-color: var(--code-keyword);
}
.text aside.note {
background-color: var(--bg-note);
border-color: var(--link-color);
}
.text aside.hint {
background-color: var(--bg-hint);
border-color: var(--code-string);
}
.text blockquote {
font-style: italic;
}
.text aside {
border-left-style: solid;
border-left-width: 6px;
}
.text table {
width: 100%;
}
.text table td,
.text table th {
font-size: 16px;
}
.text table td code,
.text table th code {
font-size: 16px;
white-space: nowrap;
}
.text table td {
padding: 10px 9px;
border: solid 1px var(--border-color);
vertical-align: top;
}
.text table th {
padding: 10px 9px 9px;
background-color: var(--text-primary);
border-left: solid 1px var(--text-primary);
border-right: solid 1px var(--text-primary);
border-bottom: solid 1px var(--text-primary);
color: var(--bg);
}
.text table tr:nth-child(2n) {
background-color: var(--bg-contrast);
}
.text table span {
white-space: nowrap;
}
.text .chapter {
color: var(--text-muted);
font-size: 16px;
color: var(--text-muted);
margin-bottom: 5px;
}
.text ul ul {
list-style-type: circle;
}
.text ul ul li {
margin-top: 5px;
}
.text hr {
margin-top: 60px;
border: none;
border-top: solid 1px var(--border-color);
}
figure.code .c {
color: var(--text-muted);
}
/* Comment */
figure.code .ch {
color: var(--text-muted);
}
/* Comment.Hashbang */
figure.code .cm {
color: var(--text-muted);
}
/* Comment.Multiline */
figure.code .cp {
color: var(--text-muted);
}
/* Comment.Preproc */
figure.code .cpf {
color: var(--text-muted);
}
/* Comment.PreprocFile */
figure.code .c1 {
color: var(--text-muted);
}
/* Comment.Single */
figure.code .cs {
color: var(--text-muted);
}
/* Comment.Special */
figure.code .s {
color: var(--code-string);
}
/* Literal.String */
figure.code .sa {
color: var(--code-string);
}
/* Literal.String.Affix */
figure.code .sb {
color: var(--code-string);
}
/* Literal.String.Backtick */
figure.code .sc {
color: var(--code-string);
}
/* Literal.String.Char */
figure.code .dl {
color: var(--code-string);
}
/* Literal.String.Delimiter */
figure.code .sd {
color: var(--code-string);
}
/* Literal.String.Doc */
figure.code .s2 {
color: var(--code-string);
}
/* Literal.String.Double */
figure.code .se {
color: var(--code-string);
}
/* Literal.String.Escape */
figure.code .sh {
color: var(--code-string);
}
/* Literal.String.Heredoc */
figure.code .si {
color: var(--code-string);
}
/* Literal.String.Interpol */
figure.code .sx {
color: var(--code-string);
}
/* Literal.String.Other */
figure.code .sr {
color: var(--code-string);
}
/* Literal.String.Regex */
figure.code .s1 {
color: var(--code-string);
}
/* Literal.String.Single */
figure.code .ss {
color: var(--code-string);
}
/* Literal.String.Symbol */
figure.code .m {
color: var(--code-number);
}
/* Literal.Number */
figure.code .il {
color: var(--code-number);
}
/* Literal.Number.Integer.Long */
figure.code .mb {
color: var(--code-number);
}
/* Literal.Number.Bin */
figure.code .mf {
color: var(--code-number);
}
/* Literal.Number.Float */
figure.code .mh {
color: var(--code-number);
}
/* Literal.Number.Hex */
figure.code .mi {
color: var(--code-number);
}
/* Literal.Number.Integer */
figure.code .mo {
color: var(--code-number);
}
/* Literal.Number.Oct */
figure.code .k {
color: var(--code-keyword);
}
/* Keyword */
figure.code .kc {
color: var(--code-keyword);
}
/* Keyword.Constant */
figure.code .kd {
color: var(--code-keyword);
}
/* Keyword.Declaration */
figure.code .kn {
color: var(--code-keyword);
}
/* Keyword.Namespace */
figure.code .kp {
color: var(--code-keyword);
}
/* Keyword.Pseudo */
figure.code .kr {
color: var(--code-keyword);
}
/* Keyword.Reserved */
/*figure.code .kt { color: $rose;} /* Keyword.Type */
figure.code .o {
color: var(--code-number);
}
/* Operator */
figure.code .ow {
color: var(--code-number);
}
/* Operator.Word */
figure.code .na {
color: var(--code-number);
}
/* Name.Attribute */
/*figure.code .nb { color: $rose;} /* Name.Builtin */
figure.code .nc {
color: var(--code-number);
}
/* Name.Class */
figure.code .no {
color: var(--code-number);
}
/* Name.Constant */
figure.code .nd {
color: var(--code-number);
}
/* Name.Decorator */
figure.code .ni {
color: var(--code-number);
}
/* Name.Entity */
figure.code .ne {
color: var(--code-number);
}
/* Name.Exception */
figure.code .nl {
color: var(--code-number);
}
/* Name.Label */
figure.code .nn {
color: var(--code-number);
}
/* Name.Namespace */
figure.code .nt {
color: var(--code-number);
}
/* Name.Tag */
figure.code .nv {
color: var(--code-number);
}
/* Name.Variable */
figure.code .bp {
color: var(--code-number);
}
/* Name.Builtin.Pseudo */
figure.code .fm {
color: var(--code-number);
}
/* Name.Function.Magic */
figure.code .vc {
color: var(--code-number);
}
/* Name.Variable.Class */
figure.code .vg {
color: var(--code-number);
}
/* Name.Variable.Global */
figure.code .vi {
color: var(--code-number);
}
/* Name.Variable.Instance */
figure.code .vm {
color: var(--code-number);
}
/* Name.Variable.Magic */
.qa {
margin: 30px 0;
}
.qa > div {
background: var(--bg-contrast);
border: solid 1px var(--border-color);
padding-left: 1em;
padding-right: 1em;
clear: both;
}
.qa .a {
border-top: solid 1px transparent;
}
.qa .a .hidden {
display: none;
}
.qa ul {
list-style-type: none;
padding-left: 0;
}
.qa ul input {
position: relative;
left: -5px;
top: -2px;
vertical-align: middle;
margin-right: 5px;
}
.show-answer {
display: block;
margin: 20px 0;
}
.wrapper {
width: 100%;
max-width: var(--text-width);
margin-left: auto;
margin-right: auto;
}
main {
margin-top: 60px;
margin-bottom: 60px;
min-height: calc(100vh - 75px - 75px - 120px);
}
header,
footer {
background-color: var(--bg-contrast);
padding: 25px 0;
font-size: 16px;
color: var(--text-muted);
}
header {
border-bottom: solid 1px var(--border-color);
}
header .wrapper {
display: grid;
grid-template-columns: 1fr auto;
}
footer {
border-top: solid 1px var(--border-color);
}
footer .wrapper {
display: grid;
grid-template-columns: repeat(3, 80px);
justify-content: space-between;
}
footer .wrapper div:nth-child(2) {
text-align: center;
}
footer .wrapper div:last-child {
text-align: right;
}
img[src="assets/img/cover.png"] {
margin-bottom: 30px;
}
@media only screen and (max-width: 820px) {
body {
font-size: 18px;
}
.wrapper {
padding-left: 30px;
padding-right: 30px;
}
main {
margin-top: 40px;
margin-bottom: 40px;
}
.crumbs {
display: none;
}
.text h1,
.text h2 {
font-size: 37px;
}
}
@JaimeStill
Copy link
Author

Added an additional variable for adjusting the width of the text. 760px was a bit narrow for my liking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment