Skip to content

Commit a1ce785

Browse files
authored
Align Frequency theme (#71)
Aligns the theme with other places it is used. - Swap out light mode code highlighting - Swap out dark mode code highlighting - Remove unused ace editor references - Easier theme css naming
1 parent aee4bd5 commit a1ce785

File tree

10 files changed

+202
-201
lines changed

10 files changed

+202
-201
lines changed

book.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ command = "node preprocessor.mjs"
1010

1111
[output.html]
1212
no-section-label = true
13-
copy-fonts = false # Switched to custom fonts
13+
copy-fonts = false # Switched to custom fonts
1414
site-url = "/pages/"
1515
git-repository-url = "https://github.com/frequency-chain/docs"
1616
edit-url-template = "https://github.com/frequency-chain/docs/blob/main/{path}"
1717
preferred-dark-theme = "coal"
18-
additional-css = ["css/extended.css"]
18+
additional-css = [
19+
"css/extended.css",
20+
"css/highlight.css",
21+
"css/highlight-dark.css",
22+
]
1923

2024
# https://github.com/Michael-F-Bryan/mdbook-linkcheck
2125
[output.linkcheck]

theme/tomorrow-night.css renamed to css/highlight-dark.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
color: #b294bb;
7777
}
7878

79-
.hljs {
79+
pre .hljs {
8080
display: block;
8181
overflow-x: auto;
82-
/* background: #1d1f21; */
83-
/* color: #c5c8c6; */
82+
background: #1d1f21;
83+
color: #c5c8c6;
8484
padding: 0.5em;
8585
}
8686

css/highlight.css

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*!
2+
Theme: Atelier Cave Light
3+
Author: Bram de Haan (http://atelierbramdehaan.nl)
4+
License: ~ MIT (or more permissive) [via base16-schemes-source]
5+
Maintainer: @highlightjs/core-team
6+
Version: 2021.09.0
7+
*/
8+
9+
/*
10+
11+
- https://github.com/highlightjs/base16-highlightjs
12+
*/
13+
14+
/*
15+
base00 #efecf4 Default Background
16+
base01 #e2dfe7 Lighter Background (Used for status bars, line number and folding marks)
17+
base02 #8b8792 Selection Background
18+
base03 #7e7887 Comments, Invisibles, Line Highlighting
19+
base04 #655f6d Dark Foreground (Used for status bars)
20+
base05 #585260 Default Foreground, Caret, Delimiters, Operators
21+
base06 #26232a Light Foreground (Not often used)
22+
base07 #19171c Light Background (Not often used)
23+
base08 #be4678 Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
24+
base09 #aa573c Integers, Boolean, Constants, XML Attributes, Markup Link Url
25+
base0A #a06e3b Classes, Markup Bold, Search Text Background
26+
base0B #2a9292 Strings, Inherited Class, Markup Code, Diff Inserted
27+
base0C #398bc6 Support, Regular Expressions, Escape Characters, Markup Quotes
28+
base0D #576ddb Functions, Methods, Attribute IDs, Headings
29+
base0E #955ae7 Keywords, Storage, Selector, Markup Italic, Diff Changed
30+
base0F #bf40bf Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
31+
*/
32+
33+
pre code.hljs {
34+
display: block;
35+
overflow-x: auto;
36+
padding: 1em;
37+
}
38+
39+
code.hljs {
40+
padding: 3px 5px;
41+
}
42+
43+
pre .hljs {
44+
color: #585260;
45+
background: #efecf4;
46+
}
47+
48+
.hljs::selection,
49+
.hljs ::selection {
50+
background-color: #8b8792;
51+
color: #585260;
52+
}
53+
54+
/* purposely do not highlight these things */
55+
.hljs-formula,
56+
.hljs-params,
57+
.hljs-property {
58+
}
59+
60+
/* base03 - #7e7887 - Comments, Invisibles, Line Highlighting */
61+
.hljs-comment {
62+
color: #7e7887;
63+
}
64+
65+
/* base04 - #655f6d - Dark Foreground (Used for status bars) */
66+
.hljs-tag {
67+
color: #655f6d;
68+
}
69+
70+
/* base05 - #585260 - Default Foreground, Caret, Delimiters, Operators */
71+
.hljs-subst,
72+
.hljs-punctuation,
73+
.hljs-operator {
74+
color: #585260;
75+
}
76+
77+
.hljs-operator {
78+
opacity: 0.7;
79+
}
80+
81+
/* base08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted */
82+
.hljs-bullet,
83+
.hljs-variable,
84+
.hljs-template-variable,
85+
.hljs-selector-tag,
86+
.hljs-name,
87+
.hljs-deletion {
88+
color: #be4678;
89+
}
90+
91+
/* base09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url */
92+
.hljs-symbol,
93+
.hljs-number,
94+
.hljs-link,
95+
.hljs-attr,
96+
.hljs-variable.constant_,
97+
.hljs-literal {
98+
color: #aa573c;
99+
}
100+
101+
/* base0A - Classes, Markup Bold, Search Text Background */
102+
.hljs-title,
103+
.hljs-class .hljs-title,
104+
.hljs-title.class_ {
105+
color: #a06e3b;
106+
}
107+
108+
.hljs-strong {
109+
font-weight: bold;
110+
color: #a06e3b;
111+
}
112+
113+
/* base0B - Strings, Inherited Class, Markup Code, Diff Inserted */
114+
.hljs-code,
115+
.hljs-addition,
116+
.hljs-title.class_.inherited__,
117+
.hljs-string {
118+
color: #2a9292;
119+
}
120+
121+
/* base0C - Support, Regular Expressions, Escape Characters, Markup Quotes */
122+
.hljs-built_in,
123+
.hljs-doctag, /* guessing */
124+
.hljs-quote,
125+
.hljs-keyword.hljs-atrule,
126+
.hljs-regexp {
127+
color: #398bc6;
128+
}
129+
130+
/* base0D - Functions, Methods, Attribute IDs, Headings */
131+
.hljs-function .hljs-title,
132+
.hljs-attribute,
133+
.ruby .hljs-property,
134+
.hljs-title.function_,
135+
.hljs-section {
136+
color: #576ddb;
137+
}
138+
139+
/* base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed */
140+
.hljs-type,
141+
/* .hljs-selector-id, */
142+
/* .hljs-selector-class, */
143+
/* .hljs-selector-attr, */
144+
/* .hljs-selector-pseudo, */
145+
.hljs-template-tag,
146+
.diff .hljs-meta,
147+
.hljs-keyword {
148+
color: #955ae7;
149+
}
150+
.hljs-emphasis {
151+
color: #955ae7;
152+
font-style: italic;
153+
}
154+
155+
/* base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?> */
156+
.hljs-meta,
157+
/*
158+
prevent top level .keyword and .string scopes
159+
from leaking into meta by accident
160+
*/
161+
.hljs-meta .hljs-keyword,
162+
.hljs-meta .hljs-string {
163+
color: #bf40bf;
164+
}
165+
166+
.hljs-meta .hljs-keyword,
167+
/* for v10 compatible themes */
168+
.hljs-meta-keyword {
169+
font-weight: bold;
170+
}

pages/Governance/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Governance
22

3-
Frequency Governance currently uses [Polkadot Governance V1](https://wiki.polkadot.network/docs/learn/learn-governance): a tricameral governance structure which includes coordinated governance by three institutions: the [Frequency Council](https://cloudflare-ipfs.com/ipns/dotapps.io/?rpc=wss%3A%2F%2F1.rpc.frequency.xyz#/council), analogous to the Council in Polkadot Governance V1, the [Technical Committee](https://cloudflare-ipfs.com/ipns/dotapps.io/?rpc=wss%3A%2F%2F1.rpc.frequency.xyz#/techcomm), analogous to the Technical Committee in Polkadot Governance V1, and token holder voting, analogous to the Public in Polkadot Governance V1.
3+
Frequency Governance currently uses [Polkadot Governance V1](https://wiki.polkadot.network/docs/learn/learn-governance): a tricameral governance structure which includes coordinated governance by three institutions: the [Frequency Council](https://dotapps-io.ipns.dweb.link?rpc=wss%3A%2F%2F1.rpc.frequency.xyz#/council), analogous to the Council in Polkadot Governance V1, the [Technical Committee](https://dotapps-io.ipns.dweb.link?rpc=wss%3A%2F%2F1.rpc.frequency.xyz#/techcomm), analogous to the Technical Committee in Polkadot Governance V1, and token holder voting, analogous to the Public in Polkadot Governance V1.
44

55
## Governance Parameters
66

theme/book.js

Lines changed: 10 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ window.onunload = function () {};
77
function playground_text(playground, hidden = true) {
88
let code_block = playground.querySelector("code");
99

10-
if (window.ace && code_block.classList.contains("editable")) {
11-
let editor = window.ace.edit(code_block);
12-
return editor.getValue();
13-
} else if (hidden) {
10+
if (hidden) {
1411
return code_block.textContent;
1512
} else {
1613
return code_block.innerText;
@@ -45,26 +42,6 @@ function playground_text(playground, hidden = true) {
4542
function handle_crate_list_update(playground_block, playground_crates) {
4643
// update the play buttons after receiving the response
4744
update_play_button(playground_block, playground_crates);
48-
49-
// and install on change listener to dynamically update ACE editors
50-
if (window.ace) {
51-
let code_block = playground_block.querySelector("code");
52-
if (code_block.classList.contains("editable")) {
53-
let editor = window.ace.edit(code_block);
54-
editor.addEventListener("change", function (e) {
55-
update_play_button(playground_block, playground_crates);
56-
});
57-
// add Ctrl-Enter command to execute rust code
58-
editor.commands.addCommand({
59-
name: "run",
60-
bindKey: {
61-
win: "Ctrl-Enter",
62-
mac: "Ctrl-Enter",
63-
},
64-
exec: (_editor) => run_rust_code(playground_block),
65-
});
66-
}
67-
}
6845
}
6946

7047
// updates the visibility of play button based on `no_run` class and
@@ -162,29 +139,9 @@ function playground_text(playground, hidden = true) {
162139
return !node.parentElement.classList.contains("header");
163140
});
164141

165-
if (window.ace) {
166-
// language-rust class needs to be removed for editable
167-
// blocks or highlightjs will capture events
168-
code_nodes
169-
.filter(function (node) {
170-
return node.classList.contains("editable");
171-
})
172-
.forEach(function (block) {
173-
block.classList.remove("language-rust");
174-
});
175-
176-
code_nodes
177-
.filter(function (node) {
178-
return !node.classList.contains("editable");
179-
})
180-
.forEach(function (block) {
181-
hljs.highlightBlock(block);
182-
});
183-
} else {
184-
code_nodes.forEach(function (block) {
185-
hljs.highlightBlock(block);
186-
});
187-
}
142+
code_nodes.forEach(function (block) {
143+
hljs.highlightBlock(block);
144+
});
188145

189146
// Adding the hljs class gives code blocks the color css
190147
// even if highlighting doesn't apply
@@ -279,22 +236,6 @@ function playground_text(playground, hidden = true) {
279236

280237
buttons.insertBefore(copyCodeClipboardButton, buttons.firstChild);
281238
}
282-
283-
let code_block = pre_block.querySelector("code");
284-
if (window.ace && code_block.classList.contains("editable")) {
285-
var undoChangesButton = document.createElement("button");
286-
undoChangesButton.className = "fa fa-history reset-button";
287-
undoChangesButton.title = "Undo changes";
288-
undoChangesButton.setAttribute("aria-label", undoChangesButton.title);
289-
290-
buttons.insertBefore(undoChangesButton, buttons.firstChild);
291-
292-
undoChangesButton.addEventListener("click", function () {
293-
let editor = window.ace.edit(code_block);
294-
editor.setValue(editor.originalCode);
295-
editor.clearSelection();
296-
});
297-
}
298239
});
299240
})();
300241

@@ -304,8 +245,7 @@ function playground_text(playground, hidden = true) {
304245
var themePopup = document.getElementById("theme-list");
305246
var themeColorMetaTag = document.querySelector('meta[name="theme-color"]');
306247
var stylesheets = {
307-
ayuHighlight: document.querySelector("[href$='ayu-highlight.css']"),
308-
tomorrowNight: document.querySelector("[href$='tomorrow-night.css']"),
248+
highlightDark: document.querySelector("[href$='highlight-dark.css']"),
309249
highlight: document.querySelector("[href$='highlight.css']"),
310250
};
311251

@@ -341,36 +281,21 @@ function playground_text(playground, hidden = true) {
341281
}
342282

343283
function set_theme(theme, store = true) {
344-
let ace_theme;
345-
346284
if (theme == "coal" || theme == "navy") {
347-
stylesheets.ayuHighlight.disabled = true;
348-
stylesheets.tomorrowNight.disabled = false;
285+
stylesheets.highlightDark.disabled = false;
349286
stylesheets.highlight.disabled = true;
350-
351-
ace_theme = "ace/theme/tomorrow_night";
352-
} else if (theme == "ayu") {
353-
stylesheets.ayuHighlight.disabled = false;
354-
stylesheets.tomorrowNight.disabled = true;
355-
stylesheets.highlight.disabled = true;
356-
ace_theme = "ace/theme/tomorrow_night";
287+
} else if (theme == "ayu" || theme == "light") {
288+
stylesheets.highlightDark.disabled = true;
289+
stylesheets.highlight.disabled = false;
357290
} else {
358-
stylesheets.ayuHighlight.disabled = true;
359-
stylesheets.tomorrowNight.disabled = true;
291+
stylesheets.highlightDark.disabled = true;
360292
stylesheets.highlight.disabled = false;
361-
ace_theme = "ace/theme/dawn";
362293
}
363294

364295
setTimeout(function () {
365296
themeColorMetaTag.content = getComputedStyle(document.documentElement).backgroundColor;
366297
}, 1);
367298

368-
if (window.ace && window.editors) {
369-
window.editors.forEach(function (editor) {
370-
editor.setTheme(ace_theme);
371-
});
372-
}
373-
374299
var previousTheme = get_theme();
375300

376301
if (store) {

theme/css/chrome.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,15 @@ ul#searchresults span.teaser em {
640640
transform: rotate(90deg);
641641
}
642642

643-
.spacer {
643+
.spacer,
644+
.chapter .spacer {
644645
width: 100%;
645646
height: 1px;
646647
margin: 5px 0px;
647648
}
648649

649-
.chapter .spacer {
650+
.chapter .spacer,
651+
.chapter li.spacer {
650652
background-color: var(--sidebar-spacer);
651653
}
652654

theme/css/general.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ main {
3737
/* make wide tables scroll if they overflow */
3838
.table-wrapper {
3939
overflow-x: auto;
40+
margin-block-end: 2em;
4041
}
4142

4243
/* Don't change font size in headers. */
@@ -230,6 +231,9 @@ blockquote {
230231
margin: 20px;
231232
padding: 0 20px;
232233
border-inline-start: 2px solid var(--warning-border);
234+
/* Increase the strength of the warning */
235+
font-weight: bold;
236+
border-bottom: 2px solid var(--warning-border);
233237
}
234238

235239
.warning:before {

0 commit comments

Comments
 (0)