Skip to content

Build your personal knowledge base with Trilium Notes

feat(share): match the text content to the app's modern theme

Elian Doranef7d03c45766
diff --git a/packages/share-theme/src/base.css b/packages/share-theme/src/base.css
index a3547a1894..3c28607a8b 100644
--- a/packages/share-theme/src/base.css
+++ b/packages/share-theme/src/base.css
@@ -55,6 +55,12 @@ html.theme-light {
--muted-text-color: #666;
--card-background-color: #0000000d;
--card-background-hover-color: #0000001c;
+ /* The content colors of `theme-next-light.css`. */
+ --accented-background-color: #f5f5f5;
+ --selection-background-color: #3399FF70;
+ --kbd-color: #3f3f3f;
+ --kbd-background: #f5f5f5;
+ --kbd-border: #c9c9c9;
--right-pane-heading-color: gray;
--right-pane-item-hover-background: #00000013;
--mermaid-theme: default;
@@ -62,7 +68,7 @@ html.theme-light {
}
html.theme-dark {
- --background-primary: #333333;
+ --background-primary: #242424;
--background-secondary: #1F1F1F;
--background-highlight: #484848;
--background-active: #777777;
@@ -99,6 +105,12 @@ html.theme-dark {
--muted-text-color: #bbb;
--card-background-color: #ffffff12;
--card-background-hover-color: #ffffff20;
+ /* The content colors of `theme-next-dark.css`. */
+ --accented-background-color: #555;
+ --selection-background-color: #3399FF70;
+ --kbd-color: #e0e0e0;
+ --kbd-background: #4a4a4a;
+ --kbd-border: #3a3a3a;
--right-pane-heading-color: gray;
--right-pane-item-hover-background: #ffffff26;
--mermaid-theme: dark;
diff --git a/packages/share-theme/src/content/content.css b/packages/share-theme/src/content/content.css
index f194971542..8927403a17 100644
--- a/packages/share-theme/src/content/content.css
+++ b/packages/share-theme/src/content/content.css
@@ -1,20 +1,22 @@
@import "@triliumnext/ckeditor5/src/theme/headings.css";
@import "@triliumnext/ckeditor5/src/theme/reference_links.css";
+/* The app's text is 1.1em of the 16px base, as `style.css` sets `--ck-content-font-size`. */
:root {
--ck-content-font-family: inherit !important;
- --ck-content-font-size: inherit !important;
+ --ck-content-font-size: 1.1em !important;
--ck-content-font-color: inherit !important;
--ck-content-line-height: inherit !important;
}
+/* The app's note title is 180% of the 16px base (`note_title.css`), whatever the content's size. */
#content #title {
margin: 0 0 0.5em;
- font-size: 2em;
+ font-size: 1.8rem;
font-weight: 300;
line-height: 1.2;
color: var(--text-heading);
- border-bottom: 1px solid var(--background-highlight);
+ border-bottom: 1px solid var(--main-border-color);
}
iframe.pdf-view {
@@ -62,18 +64,127 @@ iframe.pdf-view {
right: 0.5em;
}
-/* The heading weight of the app's default theme (`theme-next/notes/text.css`) and its default
- `headingStyle`, "underline" (`ReadOnlyText.css`). */
+/* The heading weight of the app's default theme (`theme-next/notes/text.css`), and the sizes and
+ default `headingStyle`, "underline", of its read-only text (`ReadOnlyText.css`). */
.ck-content :is(h1, h2, h3, h4, h5, h6) {
font-weight: 300;
- border-bottom: 1px solid var(--background-highlight);
}
-/* The top margins of Bootstrap's reboot, which the app loads. */
+.ck-content :is(h1, h2, h3, h4:not(.include-note-title), h5, h6) {
+ border-bottom: 1px solid var(--main-border-color);
+}
+
+.ck-content {
+ h1 { font-size: 1.8em; }
+ h2 { font-size: 1.6em; }
+ h3 { font-size: 1.4em; }
+ h4 { font-size: 1.2em; }
+ h5 { font-size: 1.1em; }
+ h6 { font-size: 1em; }
+}
+
+.ck-content strong {
+ font-weight: 600;
+}
+
+/* The block spacing of Bootstrap's reboot, which the app loads. */
.ck-content :where(p, ul, ol, pre, blockquote, table) {
margin-top: 0;
}
+.ck-content :where(p, ul, ol, pre, blockquote) {
+ margin-bottom: 1rem;
+}
+
+.ck-content :where(ul, ol) {
+ padding-inline-start: 2rem;
+}
+
+.ck-content :where(ul, ol) :where(ul, ol) {
+ margin-bottom: 0;
+}
+
+.ck-content mark {
+ padding: 0.1875em;
+ background-color: #fff3cd;
+ color: #212529;
+}
+
+::selection {
+ background-color: var(--selection-background-color);
+}
+
+/* The blockquotes of the app's default theme, `theme-next/notes/text.css`. */
+:root .ck-content blockquote {
+ position: relative;
+ margin: 0 0 1rem;
+ border: 1px solid transparent !important;
+ border-radius: 10px;
+ padding: 1em 2.5em;
+ background: var(--card-background-color);
+ font-style: normal;
+}
+
+.ck-content blockquote p:last-of-type {
+ margin-bottom: 0;
+}
+
+.ck-content blockquote::before,
+.ck-content blockquote::after {
+ position: absolute;
+ top: 0;
+ font-size: 48px;
+ opacity: 0.1;
+}
+
+.ck-content blockquote::before {
+ content: "“";
+ inset-inline-start: 0.2em;
+}
+
+.ck-content blockquote::after {
+ content: "”";
+ inset-inline-end: 0.35em;
+}
+
+:root .ck-content hr {
+ margin-block: 5px;
+ height: 0;
+ border: thin solid var(--main-border-color);
+ background: none;
+ opacity: 1;
+}
+
+/* The keyboard shortcuts of the app's default theme, `theme-next/dialogs.css`. */
+.ck-content kbd {
+ display: inline-block;
+ margin: 0 2px 2px;
+ border: 1px solid var(--kbd-border);
+ border-radius: 5px;
+ padding: 2px 8px;
+ background: var(--kbd-background);
+ box-shadow:
+ 0 2px 0 var(--kbd-border),
+ inset 0 -1px 0 var(--kbd-border);
+ color: var(--kbd-color);
+ font-family: inherit;
+ font-size: 0.75em;
+ font-weight: normal;
+ line-height: 1.4;
+ letter-spacing: 0.5pt;
+ vertical-align: 1px;
+ white-space: nowrap;
+}
+
+:root .ck-content .table table:not(.layout-table) th {
+ background-color: var(--accented-background-color);
+}
+
+:root .ck-content :is(.table, .image) > figcaption {
+ background-color: var(--accented-background-color);
+ color: var(--text-primary);
+}
+
/* The links of the app's default theme, `theme-next/forms.css`; link previews and heading links have their own. */
.ck-content a:where(:not(.link-embed-mention, .link-embed-card, .toc-anchor)) {
--background: transparent;
diff --git a/packages/share-theme/src/content/footnotes.css b/packages/share-theme/src/content/footnotes.css
index 526779aea9..c0c993b1a0 100644
--- a/packages/share-theme/src/content/footnotes.css
+++ b/packages/share-theme/src/content/footnotes.css
@@ -1,7 +1,7 @@
@import "@triliumnext/ckeditor5/src/theme/footnotes.css";
.ck-content .footnote-section {
- border-top: 1px solid var(--background-highlight);
+ border-top: 1px solid var(--main-border-color);
}
.ck-content .footnote-item:target .footnote-content {