Skip to main content

css/syntax_highlighting.94fa872.css

1/* Syntax highlighting styles. */
2pre {
3 --red: var(--default-primary-color-light);
4 --green: #1bad0e;
5 --blue: #115bda;
6 --magenta: #c311d0;
7 --yellow: #c8a711;
8 --highlight: #ffeb12b3;
10 --comments: var(--red);
11 --literals: var(--magenta);
12 --strings: var(--green);
13 --names: var(--blue);
14 --punctuation: var(--accent-grey);
15 --mark: var(--highlight);
17 @media (prefers-color-scheme: dark) {
18 --red: var(--default-primary-color-dark);
19 --green: #5ff042;
20 --blue: #40c3ff;
21 --magenta: #ff42fc;
22 --yellow: #fffc42;
23 --highlight: #fffc42cc;
24 }
26 /* Comment, Comment.{Hash, Multiline, Single, Special} */
27 .c, .ch, .cm, .c1, .cs {
28 color: var(--comments);
29 }
31 /* Numbers and booleans:
32 * Literal.Number, Literal.Number.{Bin, Float, Hex, Integer, Oct},
33 * Integer.Long,
34 * Keyword.{Constant, Reserved}
35 * Name.Constant
36 */
37 .m, .mb, .mf, .mh, .mi, .mo, .il, .kc, .bp, .no {
38 color: var(--literals);
39 }
41 /* Strings:
42 * Literal.String, Literal.String.{Affix, Backtick, Char, Delimiter,
43 * …, Doc, Escape, Double, Heredoc, Interpol, Other, Regex, Single,
44 * …, Symbol} */
45 .s, .sa, .sb, .sc, .dl, .sd, .se, .s2, .sh, .si, .sx, .sr, .s1, .ss {
46 color: var(--strings);
47 }
49 /* Name */
50 .n { color: var(--names); }
52 /* Punctuation, Generic.Output */
53 .p, .go {
54 color: var(--punctuation);
55 }
57 /* Rust-specific errors */
58 .rustc_error { color: var(--red); font-weight: bold; }
59 .rustc_warning { color: var(--green); }
60 .rustc_value { color: var(--yellow); }
61 .rustc_lineno { color: var(--blue); }
63 mark {
64 background-color: var(--mark);
65 padding: 2px 0;
66 margin: -2px 0;
67 border-radius: 2px;
68 }
71/* In console snippets:
72 *
73 * - don't allow selecting the $ or the following space
74 * See https://alexwlchan.net/2021/10/console-copying/
75 * See https://stackoverflow.com/a/4407335/1558022
76 * - color the prompt blue
77 *
78 * gp = Generic.Prompt, w = Whitespace
79 */
80.language-console .gp,
81.language-console .gp + .w,
82.language-irb .gp,
83.language-irb .gp + .w {
84 color: var(--blue);
85 -webkit-touch-callout: none; /* iOS Safari */
86 -webkit-user-select: none; /* Safari */
87 -khtml-user-select: none; /* Konqueror HTML */
88 -moz-user-select: none; /* Firefox */
89 -ms-user-select: none; /* Internet Explorer/Edge */
90 user-select: none; /* Non-prefixed version, currently
91 supported by Chrome and Opera */
94/* Don't highlight the XML declaration at the top of an XML snippet.
95 * cp = Comment.Preproc*/
96.language-xml .cp {
97 color: var(--punctuation);
100/* All my Caddy and Go-formatted code uses tabs; ensure it's a 4-wide tab
101 * rather than 8-wide, which is the default stylesheet in Safari */
102.language-caddy,
103.language-go {
104 tab-size: 4;
107/* Highlight HTML tags in blue.
108 * Name.{Tag, Attribute} */
109.language-html {
110 .nt, .na {
111 color: var(--names);
112 }
115.language-css {
116 /* Don't highlight media queries. */
117 .n {
118 color: var(--body-text);
119 }
121 /* Highlight CSS colours in magenta. Name.Constant */
122 .no {
123 color: var(--literals);
124 }
126 /* Highlight selectors and properties in blue.
127 * Name.{Class, Tag, Literal, Property} */
128 .nc, .nt, .nl, .py {
129 color: var(--names)
130 };