Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 47 additions & 39 deletions docs/_extensions/mcanouil/atelier/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,66 @@
title: Atelier
author: Mickaël Canouil
version: 0.6.0
quarto-required: '>=1.9.36'
source: mcanouil/quarto-atelier@0.6.0
source-type: github
version: 0.9.0
quarto-required: ">=1.9.36"
contributes:
project:
project:
type: website
output-dir: _site
website:
repo-actions: [edit, issue]
repo-link-target: _blank
repo-link-rel: noopener noreferrer
# `locale` matches `lang: en-GB` below; override the two together.
# Naming `twitter-card` at all is what switches Quarto's Twitter
# provider on, after which it inherits title, description, image, and
# image alt from each page.
open-graph:
locale: en_GB
twitter-card:
card-style: summary_large_image
page-navigation: true
back-to-top-navigation: true
llms-txt: true
search:
location: navbar
type: overlay
# `background` and `foreground` are left to the theme on both bars: the
# chrome palette in `html/chrome.scss` sets `$navbar-bg`, `$navbar-fg`,
# `$footer-bg`, and `$footer-fg` from a layer Quarto evaluates first, so
# naming them here would be a configuration with no effect.
navbar:
search: true
page-footer:
border: true
left: |
Powered by [Quarto](https://quarto.org){target="_blank" rel="noopener noreferrer"}.
center: |
© []{#current-year} [Mickaël CANOUIL](https://mickael.canouil.fr){target="_blank" rel="noopener noreferrer"}.
format: atelier-html
formats:
common:
lang: en-GB
date-format: dddd[, the] Do [of] MMMM, YYYY
date-format: "dddd[, the] Do [of] MMMM, YYYY"
code-copy: true
code-overflow: wrap
code-link: false
html:
respect-user-color-scheme: true
# Quarto builds the canonical link from `website.site-url`, giving a
# directory index the URL of its directory. Set `canonical-url: false`
# on a page served from more than one URL, such as `404.qmd`.
canonical-url: true
# `html/chrome.scss` comes before `brand` on purpose: Quarto evaluates
# user layer defaults in reverse list order, so a file placed first is
# evaluated last, after the brand palette it derives the chrome from.
theme:
light:
- html/chrome.scss
- brand
- html/theme.scss
dark:
- html/chrome.scss
- brand
- html/theme.scss
syntax-highlighting:
Expand All @@ -43,37 +84,4 @@ contributes:
- file: html/scripts/ordinal-dates.html
- file: html/scripts/a11y-fixes.html
- file: html/scripts/navbar-tooltips.html
project:
project:
type: website
output-dir: _site
website:
repo-actions:
- edit
- issue
repo-link-target: _blank
repo-link-rel: noopener noreferrer
open-graph:
locale: en_GB
twitter-card:
card-style: summary_large_image
page-navigation: true
back-to-top-navigation: true
llms-txt: true
search:
location: navbar
type: overlay
navbar:
background: dark
foreground: light
search: true
page-footer:
border: true
background: dark
foreground: light
left: |
Powered by [Quarto](https://quarto.org){target="_blank" rel="noopener noreferrer"}.
center: >
© []{#current-year} [Mickaël CANOUIL](https://mickael.canouil.fr){target="_blank" rel="noopener
noreferrer"}.
format: atelier-html
source: mcanouil/quarto-atelier@0.9.0
134 changes: 134 additions & 0 deletions docs/_extensions/mcanouil/atelier/html/chrome.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*-- scss:defaults --*/

// ===========================================================================
// CHROME PALETTE
// ===========================================================================
// This file is listed before `brand` in the format's theme lists, which is
// what lets it read the brand palette. Quarto emits user layer defaults in
// reverse list order, so a file placed before brand has its defaults evaluated
// after brand's, where $body-bg, $body-color, and $primary are all resolved,
// and still ahead of every Quarto and Bootstrap `!default`. That is the only
// point in the cascade where the chrome can be derived from the page and still
// be handed to Quarto's own $navbar-*, $sidebar-*, and $footer-* variables.
//
// The chrome is the navbar, the page footer, and the sidebar: the bars that
// frame the page rather than carry it.

// How the chrome follows the colour scheme.
//
// auto Derived from the brand palette, so each bundle gets its own chrome
// and the bars follow the colour-scheme toggle.
// light Pinned to the light palette below in both schemes.
// dark Pinned to the dark palette below in both schemes.
$atelier-chrome: auto !default;

@if not index((auto, light, dark), $atelier-chrome) {
@error "$atelier-chrome must be auto, light, or dark, but was #{$atelier-chrome}.";
}

// The pinned palettes, each a background, a foreground, and an accent that
// every other chrome colour is derived from. Only the palette matching
// $atelier-chrome is used, so pinning light leaves the dark values inert.
$atelier-chrome-dark-bg: #1b242e !default;
$atelier-chrome-dark-fg: #e8edf2 !default;
$atelier-chrome-dark-accent: #7fa8c4 !default;

$atelier-chrome-light-bg: #eef1f5 !default;
$atelier-chrome-light-fg: #1b242e !default;
$atelier-chrome-light-accent: #1f5f80 !default;

// A project can drop `brand` from its theme list, in which case the page
// variables are only defined in the Bootstrap layer that follows this one;
// fall back to the Bootstrap defaults so `auto` still resolves.
$atelier-chrome-page-bg: if(variable-exists(body-bg), $body-bg, #fff);
$atelier-chrome-page-fg: if(variable-exists(body-color), $body-color, #212529);
$atelier-chrome-page-accent: if(variable-exists(primary), $primary, #0d6efd);

// In `auto` the bar is a light tint of the page rather than the page colour
// itself, so it still reads as a bar without a hard colour break, and the
// mix resolves per bundle: a paler paper in the light one, a lifted slate in
// the dark one.
$atelier-chrome-bg: if(
$atelier-chrome == dark,
$atelier-chrome-dark-bg,
if(
$atelier-chrome == light,
$atelier-chrome-light-bg,
mix($atelier-chrome-page-bg, $atelier-chrome-page-fg, 94%)
)
) !default;

// Both inks are run through Quarto's own `theme-contrast()`, which mixes a
// colour towards black or white only until it clears the ratio asked of it and
// returns it untouched otherwise. In `auto` that matters for the accent: a
// brand primary is picked against the page, and the bar is a tint of the page,
// so a primary sitting just above 4.5:1 on the page can fall under it here.
// Setting either variable in a project skips the correction, since a `!default`
// assignment is not evaluated at all once the variable is set.
$atelier-chrome-fg: theme-contrast(
if(
$atelier-chrome == dark,
$atelier-chrome-dark-fg,
if(
$atelier-chrome == light,
$atelier-chrome-light-fg,
$atelier-chrome-page-fg
)
),
$atelier-chrome-bg,
"AA"
) !default;

$atelier-chrome-accent: theme-contrast(
if(
$atelier-chrome == dark,
$atelier-chrome-dark-accent,
if(
$atelier-chrome == light,
$atelier-chrome-light-accent,
$atelier-chrome-page-accent
)
),
$atelier-chrome-bg,
"AA"
) !default;

// Everything else follows from that triple, so a project re-points three
// colours rather than eight.
$atelier-chrome-surface: mix($atelier-chrome-bg, $atelier-chrome-fg, 90%) !default;
$atelier-chrome-muted: mix($atelier-chrome-fg, $atelier-chrome-bg, 65%) !default;
$atelier-chrome-accent-soft: rgba($atelier-chrome-accent, 0.16) !default;

// A hairline between two surfaces, which is what the bar edges and the section
// dividers want.
$atelier-chrome-border: rgba($atelier-chrome-fg, 0.2) !default;

// The boundary of a boxed control, which WCAG 1.4.11 asks 3:1 of. The weight
// has to hold on a light bar as well as a dark one: at 0.4 it is 3.3:1 on the
// dark palette but only 2.4:1 on the light one.
$atelier-chrome-control-border: rgba($atelier-chrome-fg, 0.55) !default;

// ===========================================================================
// QUARTO CHROME VARIABLES
// ===========================================================================
// Handing the palette to Quarto's own variables is what makes the parts this
// theme cannot reach from CSS come out right: the collapsed navbar's toggler
// icon and the reader-mode toggle are SVGs with the foreground baked into the
// markup, and the sidebar link, hover, and disabled colours are contrasted
// against $sidebar-bg. These are plain assignments rather than defaults
// because Quarto's own layer, which they have to beat, uses `!default`.
$navbar-bg: $atelier-chrome-bg;
$navbar-fg: $atelier-chrome-fg;
$navbar-hl: $atelier-chrome-accent;

// Quarto fades a hovered navbar link to `rgba($navbar-hl, 0.8)`, which mixes
// the accent back into the bar and costs it about a third of its contrast;
// hover at full strength instead, which is also what the sidebar does.
$navbar-hover-color: $atelier-chrome-accent;

$sidebar-bg: $atelier-chrome-bg;
$sidebar-fg: $atelier-chrome-fg;

$footer-bg: $atelier-chrome-bg;
$footer-fg: $atelier-chrome-fg;
$footer-border-color: $atelier-chrome-border;
Loading