From 15d44aed1340f668959769b881fbc5382f8624d2 Mon Sep 17 00:00:00 2001 From: TudorAndrei Date: Thu, 5 Nov 2026 22:22:59 +0200 Subject: [PATCH] style(docs): restyle the documentation site with the Aether design tokens --- docs/assets/aether.css | 465 ++++++++++++++++++++++++++++++++++++++++- docs/book.toml | 2 +- 2 files changed, 460 insertions(+), 7 deletions(-) diff --git a/docs/assets/aether.css b/docs/assets/aether.css index baf0260..287d97e 100644 --- a/docs/assets/aether.css +++ b/docs/assets/aether.css @@ -1,24 +1,470 @@ -/* Aether tokens from DESIGN.md, applied on top of the mdBook theme. */ +/* + * Aether theme for mdBook, built from the tokens in DESIGN.md. + * Light and Rust use the light tokens. Coal, Navy and Ayu use the dark tokens. + * mdBook sets the root font size to 62.5%, so 1rem is 10px here. + */ + :root { + --sans-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; + --mono-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace; + --code-font-size: 0.875em; + --content-max-width: 760px; + --menu-bar-height: 56px; + --sidebar-target-width: 280px; + --page-padding: 24px; +} + +/* Light tokens */ +.light, .rust, html:not(.js) { + --aether-canvas: oklch(0.955 0.005 165); --aether-background: oklch(0.99 0.002 165); --aether-foreground: oklch(0.22 0.008 165); + --aether-muted: oklch(0.925 0.007 165); --aether-muted-foreground: oklch(0.46 0.012 165); --aether-primary: oklch(0.43 0.07 185); + --aether-primary-tint: oklch(0.43 0.07 185 / 10%); --aether-border: oklch(0.88 0.008 165); + --aether-success: oklch(0.46 0.09 160); + --aether-warning: oklch(0.47 0.09 80); + --aether-destructive: oklch(0.48 0.15 30); + --aether-ink-tint: oklch(0.22 0.008 165 / 5%); + --aether-shadow-raised: 0 1px 2px oklch(0.25 0.02 165 / 7%), 0 8px 24px -6px oklch(0.25 0.02 165 / 12%); + --aether-code-bg: oklch(0.965 0.004 165); + + --color-scheme: light; + --copy-button-filter: invert(45%); + --copy-button-filter-hover: invert(30%) sepia(40%) saturate(600%) hue-rotate(130deg); } +/* Dark tokens */ .coal, .navy, .ayu { + --aether-canvas: oklch(0.16 0.008 165); --aether-background: oklch(0.2 0.009 165); --aether-foreground: oklch(0.94 0.005 165); + --aether-muted: oklch(0.27 0.01 165); --aether-muted-foreground: oklch(0.72 0.012 165); --aether-primary: oklch(0.78 0.08 185); + --aether-primary-tint: oklch(0.78 0.08 185 / 12%); --aether-border: oklch(0.32 0.01 165); + --aether-success: oklch(0.72 0.1 160); + --aether-warning: oklch(0.78 0.11 80); + --aether-destructive: oklch(0.7 0.14 30); + --aether-ink-tint: oklch(0.94 0.005 165 / 6%); + --aether-shadow-raised: 0 1px 2px oklch(0 0 0 / 30%), 0 8px 24px -6px oklch(0 0 0 / 45%); + --aether-code-bg: oklch(0.18 0.008 165); + + --color-scheme: dark; + --copy-button-filter: invert(70%); + --copy-button-filter-hover: invert(85%) sepia(20%) saturate(500%) hue-rotate(130deg); } -.light, .rust { +/* Map the tokens onto the mdBook variables, for every theme. */ +.light, .rust, .coal, .navy, .ayu, html:not(.js) { + --bg: var(--aether-background); + --fg: var(--aether-foreground); + + --sidebar-bg: var(--aether-canvas); + --sidebar-fg: var(--aether-muted-foreground); + --sidebar-non-existant: var(--aether-border); + --sidebar-active: var(--aether-primary); + --sidebar-spacer: var(--aether-border); + --sidebar-header-border-color: var(--aether-primary); + + --scrollbar: var(--aether-border); + --icons: var(--aether-muted-foreground); + --icons-hover: var(--aether-foreground); --links: var(--aether-primary); + --inline-code-color: var(--aether-foreground); + + --theme-popup-bg: var(--aether-background); + --theme-popup-border: var(--aether-border); + --theme-hover: var(--aether-ink-tint); + + --quote-bg: var(--aether-canvas); + --quote-border: var(--aether-border); + --warning-border: var(--aether-warning); + + --table-border-color: var(--aether-border); + --table-header-bg: var(--aether-canvas); + --table-alternate-bg: transparent; + + --searchbar-border-color: var(--aether-border); + --searchbar-bg: var(--aether-background); + --searchbar-fg: var(--aether-foreground); + --searchbar-shadow-color: var(--aether-primary-tint); + --searchresults-header-fg: var(--aether-muted-foreground); + --searchresults-border-color: var(--aether-border); + --searchresults-li-bg: var(--aether-primary-tint); + --search-mark-bg: var(--aether-primary-tint); + + --footnote-highlight: var(--aether-primary); + --overlay-bg: oklch(0.22 0.008 165 / 30%); + + --blockquote-note-color: var(--aether-primary); + --blockquote-tip-color: var(--aether-success); + --blockquote-important-color: var(--aether-primary); + --blockquote-warning-color: var(--aether-warning); + --blockquote-caution-color: var(--aether-destructive); +} + +/* Only two themes exist now. Hide the duplicates from the theme menu. */ +#mdbook-theme-rust, +#mdbook-theme-navy, +#mdbook-theme-ayu { + display: none; +} + +/* Base type */ +html { + font-family: var(--sans-font); + font-feature-settings: "tnum"; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +body { + font-size: 1.6rem; + line-height: 1.65; +} + +code, pre, kbd { + font-family: var(--mono-font) !important; +} + +/* Menu bar */ +#mdbook-menu-bar, +#mdbook-menu-bar.bordered { + border-block-end: 1px solid var(--aether-border); + background-color: color-mix(in oklch, var(--aether-background) 85%, transparent); + backdrop-filter: saturate(140%) blur(8px); +} + +.menu-title { + font-size: 1.6rem; + font-weight: 600; + letter-spacing: -0.01em; + color: var(--aether-foreground); +} + +.icon-button { + border-radius: 8px; +} + +.icon-button:hover { + background-color: var(--aether-ink-tint); +} + +/* Sidebar */ +.sidebar { + border-inline-end: 1px solid var(--aether-border); + font-size: 1.4rem; +} + +.sidebar .sidebar-scrollbox { + padding: 20px 16px; +} + +.chapter li.chapter-item { + margin-block-start: 2px; + line-height: 1.5; +} + +.chapter li a, +.chapter li .chapter-link-wrapper > a { + padding: 4px 8px; + border-radius: 6px; + color: var(--aether-muted-foreground); +} + +.chapter li a:hover { + color: var(--aether-foreground); + background-color: var(--aether-ink-tint); + text-decoration: none; +} + +.chapter li a.active { + color: var(--aether-primary); + background-color: var(--aether-primary-tint); + font-weight: 500; +} + +.chapter li.part-title { + margin: 20px 0 4px; + padding: 0 8px; + font-size: 1.2rem; + font-weight: 600; + letter-spacing: 0.04em; + text-transform: uppercase; + color: var(--aether-foreground); +} + +.chapter li.part-title:first-child { + margin-block-start: 4px; +} + +/* The on-page heading list under the active chapter */ +.chapter .on-this-page, +.chapter ol.section { + border-inline-start: 1px solid var(--aether-border) !important; + margin-inline-start: 12px; + padding-inline-start: 8px; +} + +.sidebar-resize-handle .sidebar-resize-indicator { + opacity: 0.4; +} + +/* Content */ +.content main { + padding-block: 8px 48px; } +.content h1, +.content h2, +.content h3, +.content h4 { + color: var(--aether-foreground); + font-weight: 600; + letter-spacing: -0.025em; + text-wrap: balance; +} + +.content h1 { + font-size: 3.2rem; + line-height: 1.15; + margin-block: 32px 16px; +} + +.content h2 { + font-size: 2.2rem; + line-height: 1.3; + margin-block: 48px 12px; + padding-block-start: 24px; + border-block-start: 1px solid var(--aether-border); +} + +.content h1 + h2, +.content h1 + p + h2 { + border-block-start: 0; +} + +.content h3 { + font-size: 1.8rem; + line-height: 1.4; + margin-block: 32px 8px; +} + +.content h4 { + font-size: 1.6rem; + margin-block: 24px 8px; +} + +.content p, +.content li { + text-wrap: pretty; +} + +/* The first paragraph under the page title is the lead. */ +.content main > h1:first-child + p { + font-size: 1.8rem; + line-height: 1.55; + color: var(--aether-muted-foreground); +} + +.content a, +.content a:visited { + color: var(--aether-primary); + text-decoration: underline; + text-decoration-color: color-mix(in oklch, var(--aether-primary) 40%, transparent); + text-underline-offset: 3px; +} + +.content a:hover { + text-decoration-color: var(--aether-primary); +} + +/* Headings are links in mdBook. Keep them as plain headings. */ +.content .header:link, +.content .header:visited, +.content h1 a.header, +.content h2 a.header, +.content h3 a.header, +.content h4 a.header { + color: inherit; + text-decoration: none; +} + +/* Inline code */ +.content :not(pre) > code { + padding: 0.15em 0.4em; + border: 1px solid var(--aether-border); + border-radius: 6px; + background-color: var(--aether-muted); + font-size: 0.85em; +} + +.content a > code { + color: var(--aether-primary); +} + +/* Code blocks */ +.content pre { + margin-block: 16px; + border: 1px solid var(--aether-border); + border-radius: 12px; + background-color: var(--aether-code-bg); + overflow: hidden; +} + +.content pre > code, +.content pre > code.hljs { + padding: 16px 20px; + background: transparent; + font-size: 1.35rem; + line-height: 1.6; +} + +/* Syntax colours from the Aether tokens, the same in every theme */ +.content pre > code.hljs { color: var(--aether-foreground); } +:is(.light, .rust, .coal, .navy, .ayu) :is(.hljs-comment, .hljs-quote) { + color: var(--aether-muted-foreground); + font-style: italic; +} +:is(.light, .rust, .coal, .navy, .ayu) :is(.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-builtin-name, .hljs-title, .hljs-section) { + color: var(--aether-primary); +} +:is(.light, .rust, .coal, .navy, .ayu) :is(.hljs-string, .hljs-symbol, .hljs-bullet, .hljs-addition) { + color: var(--aether-success); +} +:is(.light, .rust, .coal, .navy, .ayu) :is(.hljs-number, .hljs-literal, .hljs-meta, .hljs-type, .hljs-params) { + color: var(--aether-warning); +} +:is(.light, .rust, .coal, .navy, .ayu) :is(.hljs-variable, .hljs-template-variable, .hljs-attr, .hljs-attribute, .hljs-name, .hljs-tag, .hljs-regexp, .hljs-link) { + color: var(--aether-foreground); + font-weight: 500; +} +:is(.light, .rust, .coal, .navy, .ayu) .hljs-deletion { + color: var(--aether-destructive); +} + +pre > .buttons { + top: 8px; + right: 8px; +} + +pre > .buttons button { + border-color: var(--aether-border); + border-radius: 6px; + background-color: var(--aether-background); +} + +/* Tables */ +.content table { + width: 100%; + margin-block: 16px; + border: 1px solid var(--aether-border); + border-radius: 12px; + border-collapse: separate; + border-spacing: 0; + overflow: hidden; + font-size: 1.45rem; +} + +.content table td, +.content table th { + padding: 10px 14px; + border: 0; + border-block-start: 1px solid var(--aether-border); + vertical-align: top; + text-align: start; +} + +.content table thead th, +.content table thead td { + border-block-start: 0; + background-color: var(--aether-canvas); + color: var(--aether-muted-foreground); + font-size: 1.25rem; + font-weight: 600; + letter-spacing: 0.02em; +} + +.content table thead th code { + font-weight: 500; +} + +.content table tbody tr:nth-child(2n) { + background: transparent; +} + +/* Blockquotes and admonitions */ +.content blockquote { + margin: 20px 0; + padding: 12px 20px; + border: 1px solid var(--aether-border); + border-radius: 8px; + background-color: var(--aether-canvas); + color: var(--aether-foreground); +} + +.content blockquote > p:first-child { margin-block-start: 0; } +.content blockquote > p:last-child { margin-block-end: 0; } + +.content hr { + border: 0; + border-block-start: 1px solid var(--aether-border); + margin-block: 32px; +} + +/* Previous and next */ +.nav-chapters { + color: var(--aether-muted-foreground); + font-size: 2.4rem; +} + +.nav-chapters:hover { + color: var(--aether-primary); + background: transparent; +} + +.mobile-nav-chapters { + border-radius: 8px; + background-color: var(--aether-canvas); +} + +/* Search */ +#mdbook-searchbar { + border-radius: 8px; + padding: 8px 12px; + font-family: var(--sans-font); +} + +#mdbook-searchbar:focus, +#mdbook-searchbar.active { + box-shadow: 0 0 0 3px var(--aether-primary-tint); + border-color: var(--aether-primary); +} + +ul#mdbook-searchresults li { + border-radius: 8px; +} + +/* Theme menu */ +.theme-popup { + border-radius: 8px; + overflow: hidden; + box-shadow: var(--aether-shadow-raised); +} + +/* Focus */ +a:focus-visible, +button:focus-visible { + outline: 2px solid var(--aether-primary); + outline-offset: 2px; + border-radius: 6px; +} + +/* Landing page: the two onboarding paths */ .aether-paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); @@ -26,14 +472,16 @@ margin: 24px 0 32px; } -.content a.aether-path { +.content a.aether-path, +.content a.aether-path:visited { display: flex; flex-direction: column; gap: 6px; - padding: 20px; + padding: 24px; border: 1px solid var(--aether-border); border-radius: 12px; background: var(--aether-background); + box-shadow: var(--aether-shadow-raised); color: var(--aether-foreground); text-decoration: none; transition: border-color 150ms ease, transform 150ms ease; @@ -56,7 +504,7 @@ .aether-path-kicker { font-size: 1.2rem; - font-weight: 500; + font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--aether-primary); @@ -66,10 +514,15 @@ font-size: 1.8rem; font-weight: 600; line-height: 1.3; + letter-spacing: -0.015em; } .aether-path-body { - font-size: 1.4rem; + font-size: 1.45rem; line-height: 1.5; color: var(--aether-muted-foreground); } + +.content a.aether-path code { + color: var(--aether-foreground); +} diff --git a/docs/book.toml b/docs/book.toml index 90fc241..4c24795 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -15,5 +15,5 @@ git-repository-url = "https://github.com/flowcopilot/aether" edit-url-template = "https://github.com/flowcopilot/aether/edit/main/docs/{path}" additional-css = ["assets/aether.css"] default-theme = "light" -preferred-dark-theme = "navy" +preferred-dark-theme = "coal" no-section-label = true