Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(presentation): fall back to system fonts in the vendored themes
Elian Doran79f66ca72ecd
diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/README.md b/apps/client/src/widgets/collections/presentation/reveal-themes/README.mdindex 60febf2df6..016de685f2 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/README.md+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/README.md@@ -19,18 +19,26 @@ Compiled from these sources, a theme is about 5 KB (1.4 KB gzipped).## What changed from upstream-One deleted line per theme — the `@import url(…)` that pulls in a font — and nothing else. Twelve-of the fourteen themes lost one or two; `serif.scss` and `dracula.scss` were already on system font-stacks and are byte-identical to upstream.+Two things, both about fonts.-Removing a font leaves the rest of the stack. `black`, `white` and `beige` fall back to Helvetica;-`solarized` and `moon` headings fall from League Gothic to Impact. The visible ones are `sky`-(Quicksand) and `simple` (News Cycle), whose display headings drop to a generic sans.+Every `@import url(…)` that pulled in a font is deleted — one or two lines per theme. That covers+the local `.woff` sheets Vite inlined and the Google Fonts URLs.++Each remaining stack then gained a real fallback. A theme still names its own family first, which+costs nothing and applies where the reader happens to have it installed, but behind it now sits a+system stack from `template/_system-fonts.scss` rather than a bare `sans-serif`. So `black` reads+in the platform UI face instead of Helvetica, and `simple` and `night` headings land on Impact+rather than on whatever the browser picks for a generic sans.++`serif.scss` and `dracula.scss` are untouched and byte-identical to upstream: both were already on+system stacks.## Re-syncing after a reveal.js upgrade-Diff `node_modules/reveal.js/css/theme` against this directory. Every hunk should be one of the-`@import url(…)` lines below; anything else is a real upstream change to carry over.+Diff `node_modules/reveal.js/css/theme` against this directory. Every hunk should be a deleted+`@import url(…)` from the list below, a `$main-font` / `$heading-font` value carrying a+`#{fonts.$…}` stack, or the `@use 'template/system-fonts' as fonts;` line those need. Anything else+is a real upstream change to carry over.```@import url('./fonts/source-sans-pro/source-sans-pro.css'); black, black-contrast, white, white-contrast@@ -49,5 +57,8 @@ Diff `node_modules/reveal.js/css/theme` against this directory. Every hunk shoulrules from them, and `template/mixins.scss` holds `light-bg-text-color`. A theme file is 40 to 90lines: a `@use 'template/settings' with (…)` block of overrides, then `@use 'template/theme'`.+`template/_system-fonts.scss` is the one file here upstream does not have. It holds `$sans` and+`$condensed`, and nine themes plus `settings.scss` read their fallbacks from it.+`black-contrast` and `white-contrast` are the higher-contrast variants of `black` and `white`;`league` and `night` round out the upstream set. None of the four is in the picker today.diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/beige.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/beige.scssindex 83a674d3f4..f3d7afe265 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/beige.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/beige.scss@@ -7,6 +7,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #8b743d;@@ -14,12 +15,12 @@ $active-color: #8b743d;@use 'template/settings' with ($background-color: #f7f3de,$background: radial-gradient(rgba(255, 255, 255, 1), rgba(247, 242, 211, 1)),- $main-font: "'Source Sans Pro', Helvetica, sans-serif",+ $main-font: "'Source Sans Pro', #{fonts.$sans}",$main-font-size: 42px,$main-color: #333,$heading-color: #333,- $heading-font: "'Source Sans Pro', Helvetica, sans-serif",+ $heading-font: "'Source Sans Pro', #{fonts.$sans}",$heading-font-weight: 600,$heading1-text-shadow: #{0 1px 0 #ccc,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/black-contrast.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/black-contrast.scssindex aab762a1d2..cc7d8e6538 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/black-contrast.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/black-contrast.scss@@ -10,6 +10,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #42affa;@@ -17,12 +18,12 @@ $active-color: #42affa;@use 'template/settings' with ($background-color: #000,- $main-font: "'Source Sans Pro', Helvetica, sans-serif",+ $main-font: "'Source Sans Pro', #{fonts.$sans}",$main-font-size: 42px,$main-color: #fff,$heading-color: #fff,- $heading-font: "'Source Sans Pro', Helvetica, sans-serif",+ $heading-font: "'Source Sans Pro', #{fonts.$sans}",$heading-font-weight: 600,$heading1-size: 2.5em,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/black.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/black.scssindex 5485e65e5f..45bc2f7b54 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/black.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/black.scss@@ -7,6 +7,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #42affa;@@ -14,12 +15,12 @@ $active-color: #42affa;@use 'template/settings' with ($background-color: #191919,- $main-font: "'Source Sans Pro', Helvetica, sans-serif",+ $main-font: "'Source Sans Pro', #{fonts.$sans}",$main-font-size: 42px,$main-color: #fff,$heading-color: #fff,- $heading-font: "'Source Sans Pro', Helvetica, sans-serif",+ $heading-font: "'Source Sans Pro', #{fonts.$sans}",$heading-font-weight: 600,$heading1-size: 2.5em,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/blood.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/blood.scssindex ec10a521a4..8e9adeb65f 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/blood.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/blood.scss@@ -13,6 +13,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$coal: #222;$active-color: #a23;@@ -22,10 +23,10 @@ $code-background-color: #23241f;@use 'template/settings' with ($background-color: $coal,- $main-font: 'Ubuntu, sans-serif',+ $main-font: "Ubuntu, #{fonts.$sans}",$main-color: #eee,- $heading-font: 'Ubuntu, sans-serif',+ $heading-font: "Ubuntu, #{fonts.$sans}",$heading-text-shadow: 2px 2px 2px $coal,$heading1-text-shadow: #{0 1px 0 #ccc,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/night.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/night.scssindex 5744533856..b3546f3df8 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/night.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/night.scss@@ -7,6 +7,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #e7ad52;@@ -14,11 +15,11 @@ $active-color: #e7ad52;@use 'template/settings' with ($background-color: #111,- $main-font: "'Open Sans', sans-serif",+ $main-font: "'Open Sans', #{fonts.$sans}",$main-color: #fff,$heading-color: #fff,- $heading-font: "'Montserrat', Impact, sans-serif",+ $heading-font: "'Montserrat', #{fonts.$condensed}",$heading-text-transform: none,$heading-letter-spacing: -0.03em,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/simple.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/simple.scssindex b796024160..0f7150f26a 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/simple.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/simple.scss@@ -9,6 +9,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #00008b;@@ -17,10 +18,10 @@ $active-color: #00008b;$background-color: #fff,$main-color: #000,- $main-font: "'Lato', sans-serif",+ $main-font: "'Lato', #{fonts.$sans}",$heading-color: #000,- $heading-font: "'News Cycle', Impact, sans-serif",+ $heading-font: "'News Cycle', #{fonts.$condensed}",$heading-font-weight: 600,$heading1-size: 2.5em,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/sky.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/sky.scssindex d3b0084372..a6be0ce90f 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/sky.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/sky.scss@@ -7,6 +7,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #2a76dd;@@ -16,10 +17,10 @@ $active-color: #2a76dd;$background-color: #f7fbfc,$main-color: #333,- $main-font: "'Open Sans', sans-serif",+ $main-font: "'Open Sans', #{fonts.$sans}",$heading-color: #333,- $heading-font: "'Quicksand', sans-serif",+ $heading-font: "'Quicksand', #{fonts.$sans}",$heading-letter-spacing: -0.05em,$link-color: $active-color,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/template/_system-fonts.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/template/_system-fonts.scssnew file mode 100644index 0000000000..0a8a6a0243--- /dev/null+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/template/_system-fonts.scss@@ -0,0 +1,12 @@+// Stacks that stand behind the family a theme names, so a slide still renders in something chosen+// rather than in whatever `sans-serif` resolves to. The vendored themes embed no fonts, so a named+// family applies only where the reader already has it installed.+//+// $sans is the stack reveal.js's own Dracula theme carries.++$sans: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui,+ helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;++// Display headings. Impact is the condensed face Windows and macOS both ship, and the one upstream+// already falls back to.+$condensed: Impact, Haettenschweiler, 'Arial Narrow Bold', 'Liberation Sans Narrow', sans-serif;diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/template/settings.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/template/settings.scssindex 1e57b154a6..923ada5be3 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/template/settings.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/template/settings.scss@@ -3,13 +3,14 @@@use 'sass:color';@use 'sass:meta';+@use 'system-fonts' as fonts;// Background of the presentation$background: #2b2b2b !default;$background-color: #bbb !default;// Primary/body text-$main-font: 'Lato', sans-serif !default;+$main-font: "'Lato', #{fonts.$sans}" !default;$main-font-size: 40px !default;$main-color: #eee !default;@@ -18,7 +19,7 @@ $block-margin: 20px !default;// Headings$heading-margin: 0 0 20px 0 !default;-$heading-font: 'League Gothic', Impact, sans-serif !default;+$heading-font: "'League Gothic', #{fonts.$condensed}" !default;$heading-color: #eee !default;$heading-line-height: 1.2 !default;$heading-letter-spacing: normal !default;diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/white-contrast.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/white-contrast.scssindex 3510455562..f86e5a7a37 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/white-contrast.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/white-contrast.scss@@ -10,6 +10,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #2a76dd;@@ -17,12 +18,12 @@ $active-color: #2a76dd;@use 'template/settings' with ($background-color: #fff,- $main-font: "'Source Sans Pro', Helvetica, sans-serif",+ $main-font: "'Source Sans Pro', #{fonts.$sans}",$main-font-size: 42px,$main-color: #000,$heading-color: #000,- $heading-font: "'Source Sans Pro', Helvetica, sans-serif",+ $heading-font: "'Source Sans Pro', #{fonts.$sans}",$heading-font-weight: 600,$heading1-size: 2.5em,diff --git a/apps/client/src/widgets/collections/presentation/reveal-themes/white.scss b/apps/client/src/widgets/collections/presentation/reveal-themes/white.scssindex 8b83bc47ae..cbf547a9b0 100644--- a/apps/client/src/widgets/collections/presentation/reveal-themes/white.scss+++ b/apps/client/src/widgets/collections/presentation/reveal-themes/white.scss@@ -7,6 +7,7 @@// Load utils@use 'sass:color';@use 'template/mixins' as mixins;+@use 'template/system-fonts' as fonts;$active-color: #2a76dd;@@ -15,11 +16,11 @@ $active-color: #2a76dd;$background-color: #fff,$main-color: #222,- $main-font: "'Source Sans Pro', Helvetica, sans-serif",+ $main-font: "'Source Sans Pro', #{fonts.$sans}",$main-font-size: 42px,$heading-color: #222,- $heading-font: "'Source Sans Pro', Helvetica, sans-serif",+ $heading-font: "'Source Sans Pro', #{fonts.$sans}",$heading-font-weight: 600,$heading1-size: 2.5em,