diff --git a/book.toml b/book.toml index 0416bf2..94ac79b 100644 --- a/book.toml +++ b/book.toml @@ -8,9 +8,9 @@ src = "." build-dir = "./book" [output.html] -default-theme = "light" -preferred-dark-theme = "navy" -additional-css = ["theme/css/roost.css"] +default-theme = "roost" +preferred-dark-theme = "roost" +additional-css = ["theme/css/roost.css", "theme/css/roost-hljs.css", "theme/css/content.css"] edit-url-template = "https://github.com/roostorg/community/edit/main/{path}" git-repository-url = "https://github.com/roostorg" site-url = "/community/" diff --git a/theme/css/content.css b/theme/css/content.css new file mode 100644 index 0000000..632f619 --- /dev/null +++ b/theme/css/content.css @@ -0,0 +1,46 @@ +/* Content styling overrides */ + +.content img { + border: 0.5em solid color-mix(var(--bg) 80%, white); + box-shadow: 0 0.25em 0.5em 0.25em rgba(0 0 0 / 0.1 ); + box-sizing: border-box; + margin-block: 0.5em; +} + +.blockquote-tag { + background: var(--quote-bg); + border-radius: 0.25em; + padding: 1em; +} + +.menu-title { + font-weight: 600; +} + +table { + width: 100%; +} + +table td, +table thead th { + padding: 0.25em 0.5em; +} + +table td { + text-wrap: balance; +} + +dt { + margin-block: 1.5em 0; +} + +dd { + margin-inline-start: 1em; + margin-block: 0.25em; +} + +hr { + margin-block: 2em; + opacity: 0.25; +} + diff --git a/theme/css/roost-hljs.css b/theme/css/roost-hljs.css new file mode 100644 index 0000000..7fadf1f --- /dev/null +++ b/theme/css/roost-hljs.css @@ -0,0 +1,199 @@ +/*! + Theme: a11y-light + Author: @ericwbailey + Maintainer: @ericwbailey + + Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css +*/ + +.roost .hljs { + background: #fefefe; + color: #545454; +} + +/* Comment */ +.roost .hljs-comment, +.roost .hljs-quote { + color: #696969; +} + +/* Red */ +.roost .hljs-variable, +.roost .hljs-template-variable, +.roost .hljs-tag, +.roost .hljs-name, +.roost .hljs-selector-id, +.roost .hljs-selector-class, +.roost .hljs-regexp, +.roost .hljs-deletion { + color: #d91e18; +} + +/* Orange */ +.roost .hljs-number, +.roost .hljs-built_in, +.roost .hljs-literal, +.roost .hljs-type, +.roost .hljs-params, +.roost .hljs-meta, +.roost .hljs-link { + color: #aa5d00; +} + +/* Yellow */ +.roost .hljs-attribute { + color: #aa5d00; +} + +/* Green */ +.roost .hljs-string, +.roost .hljs-symbol, +.roost .hljs-bullet, +.roost .hljs-addition { + color: #008000; +} + +/* Blue */ +.roost .hljs-title, +.roost .hljs-section { + color: #007faa; +} + +/* Purple */ +.roost .hljs-keyword, +.roost .hljs-selector-tag { + color: #7928a1; +} + +.roost .hljs-emphasis { + font-style: italic; +} + +.roost .hljs-strong { + font-weight: bold; +} + +@media screen and (-ms-high-contrast: active) { + .roost .hljs-addition, + .roost .hljs-attribute, + .roost .hljs-built_in, + .roost .hljs-bullet, + .roost .hljs-comment, + .roost .hljs-link, + .roost .hljs-literal, + .roost .hljs-meta, + .roost .hljs-number, + .roost .hljs-params, + .roost .hljs-string, + .roost .hljs-symbol, + .roost .hljs-type, + .roost .hljs-quote { + color: highlight; + } + + .roost .hljs-keyword, + .roost .hljs-selector-tag { + font-weight: bold; + } +} + +@media (prefers-color-scheme: dark) { + /*! + Theme: a11y-dark + Author: @ericwbailey + Maintainer: @ericwbailey + + Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css + */ + + .roost .hljs { + background: #2b2b2b; + color: #f8f8f2; + } + + /* Comment */ + .roost .hljs-comment, + .roost .hljs-quote { + color: #d4d0ab; + } + + /* Red */ + .roost .hljs-variable, + .roost .hljs-template-variable, + .roost .hljs-tag, + .roost .hljs-name, + .roost .hljs-selector-id, + .roost .hljs-selector-class, + .roost .hljs-regexp, + .roost .hljs-deletion { + color: #ffa07a; + } + + /* Orange */ + .roost .hljs-number, + .roost .hljs-built_in, + .roost .hljs-literal, + .roost .hljs-type, + .roost .hljs-params, + .roost .hljs-meta, + .roost .hljs-link { + color: #f5ab35; + } + + /* Yellow */ + .roost .hljs-attribute { + color: #ffd700; + } + + /* Green */ + .roost .hljs-string, + .roost .hljs-symbol, + .roost .hljs-bullet, + .roost .hljs-addition { + color: #abe338; + } + + /* Blue */ + .roost .hljs-title, + .roost .hljs-section { + color: #00e0e0; + } + + /* Purple */ + .roost .hljs-keyword, + .roost .hljs-selector-tag { + color: #dcc6e0; + } + + .roost .hljs-emphasis { + font-style: italic; + } + + .roost .hljs-strong { + font-weight: bold; + } + + @media screen and (-ms-high-contrast: active) { + .roost .hljs-addition, + .roost .hljs-attribute, + .roost .hljs-built_in, + .roost .hljs-bullet, + .roost .hljs-comment, + .roost .hljs-link, + .roost .hljs-literal, + .roost .hljs-meta, + .roost .hljs-number, + .roost .hljs-params, + .roost .hljs-string, + .roost .hljs-symbol, + .roost .hljs-type, + .roost .hljs-quote { + color: highlight; + } + + .roost .hljs-keyword, + .roost .hljs-selector-tag { + font-weight: bold; + } + } +} diff --git a/theme/css/roost.css b/theme/css/roost.css index 1bc526a..2f3b6bc 100644 --- a/theme/css/roost.css +++ b/theme/css/roost.css @@ -1,4 +1,5 @@ -:root { +.roost, +html:not(.js) { color-scheme: light dark; background-color: var(--roost-charcoal); @@ -12,7 +13,7 @@ --bg: rgba(250 250 250); --fg: var(--roost-charcoal); --sidebar-header-border-color: oklch(from var(--roost-yellow) calc(l * 0.95) c h); - --sidebar-resize-indicator-space: 0; + --sidebar-resize-indicator-space: 0px; --sidebar-bg: var(--roost-charcoal); --sidebar-fg: rgba(255 255 255 / 0.9); --sidebar-non-existant: #5c6773; @@ -64,9 +65,13 @@ --overlay-bg: color-mix(var(--fg), transparent); } +html:not(.js) { + --sidebar-resize-indicator-width: 0px; +} @media (prefers-color-scheme: dark) { - :root { + .roost, + html:not(.js) { --color-scheme: dark; --bg: color-mix(var(--roost-charcoal) 90%, black); --fg: rgba(255 255 255 / 0.9); @@ -75,111 +80,63 @@ } } -/* Style */ +/* Theme overrides */ -#mdbook-searchbar { - border-radius: 999px; +.roost body { + background-color: var(--bg); + min-height: calc(100vh + var(--menu-bar-height)); } -#mdbook-menu-bar { +.roost #mdbook-menu-bar { background-color: var(--roost-charcoal); border: none; box-shadow: 0 0.25em 1em rgba(0 0 0 / 0.25); } -.content { - padding: 2em 1em 1em; +.roost #mdbook-theme-toggle { + x-display: none; } -.content a { - font-weight: bold; - text-decoration: underline; -} - -a:link.mobile-nav-chapters { - color: var(--roost-yellow); -} - -.content img { - border: 0.5em solid color-mix(var(--bg) 80%, white); - box-shadow: 0 0.25em 0.5em 0.25em rgba(0 0 0 / 0.1 ); - box-sizing: border-box; - margin-block: 0.5em; -} - -.blockquote-tag { - background: var(--quote-bg); - border-radius: 0.25em; - padding: 1em; -} - -#mdbook-searchbar { +.roost #mdbook-searchbar { + border-radius: 999px; transition: none; } -ul#mdbook-searchresults li { - margin-block: 1.25em; -} - -.menu-title { - font-weight: 600; -} - -table { - width: 100%; -} - -table td, -table thead th { - padding: 0.25em 0.5em; -} - -table td { - text-wrap: balance; -} - -dt { - margin-block: 1.5em 0; +.roost #mdbook-searchbar:focus-visible { + outline: 1px solid color-mix(var(--searchbar-shadow-color), transparent); } -dd { - margin-inline-start: 1em; - margin-block: 0.25em; +.roost ul#mdbook-searchresults li { + margin-block: 1.25em; } -hr { - margin-block: 2em; - opacity: 0.25; +.roost #mdbook-sidebar { + z-index: 102; } -/* Fixes */ - -body { - background-color: var(--bg); - min-height: calc(100vh + var(--menu-bar-height)); +.roost #mdbook-sidebar-resize-handle { + background-color: var(--sidebar-bg); } -#mdbook-theme-toggle { - display: none; +.roost :not(pre):not(a) > .hljs { + background: color-mix(var(--fg) 10%, transparent); } -#mdbook-sidebar { - z-index: 102; +.roost .nav-wide-wrapper { + --icons: color-mix(var(--fg) 25%, transparent); + --icons-hover: var(--fg); } -#mdbook-sidebar-resize-handle { - background-color: var(--sidebar-bg); +.roost .content { + padding: 2em 1em 1em; } -#mdbook-searchbar:focus-visible { - outline: 1px solid color-mix(var(--searchbar-shadow-color), transparent); +.roost .content a { + font-weight: bold; + text-decoration: underline; } -:not(pre):not(a) > .hljs { - background: color-mix(var(--fg) 10%, transparent); +.roost a:link.mobile-nav-chapters { + color: var(--roost-yellow); } -.nav-wide-wrapper { - --icons: color-mix(var(--fg) 25%, transparent); - --icons-hover: var(--fg); -} diff --git a/theme/index.hbs b/theme/index.hbs new file mode 100644 index 0000000..1c790ab --- /dev/null +++ b/theme/index.hbs @@ -0,0 +1,367 @@ + + + + + + {{ title }} + {{#if is_print }} + + {{/if}} + {{#if base_url}} + + {{/if}} + + + + {{> head}} + + + + + + {{#if favicon_svg}} + + {{/if}} + {{#if favicon_png}} + + {{/if}} + + + + {{#if print_enable}} + + {{/if}} + + + + + + + + + + + {{#each additional_css}} + + {{/each}} + + {{#if mathjax_support}} + + + {{/if}} + + + + + + + +
+
+

Keyboard shortcuts

+
+

Press ← or → to navigate between chapters

+ {{#if search_enabled}} +

Press S or / to search in the book

+ {{/if}} +

Press ? to show this help

+

Press Esc to hide this help

+
+
+
+
+ + + + + + + + + + + + + +
+ +
+ {{> header}} +
+ + + {{#if search_enabled}} + + {{/if}} + + + + + +
+ + + +
+ + + + + + + + {{#if live_reload_endpoint}} + + + {{/if}} + + {{#if playground_line_numbers}} + + {{/if}} + + {{#if playground_copyable}} + + {{/if}} + + {{#if playground_js}} + + + + + + {{/if}} + + {{#if search_js}} + + + + {{/if}} + + + + + + + {{#each additional_js}} + + {{/each}} + + {{#if is_print}} + {{#if mathjax_support}} + + {{else}} + + {{/if}} + {{/if}} + + {{#if fragment_map}} + + {{/if}} + +
+ +