Fix theme to dark and hide the theme switch in the share template

This commit is contained in:
trilium-share-gruvbox
2026-09-07 21:47:03 +02:00
parent 7d5c9ef81a
commit ce6dbe1bab
+3 -5
View File
@@ -69,13 +69,11 @@
const openGraphDomain = subRoot.note.getLabelValue("shareOpenGraphDomain"); const openGraphDomain = subRoot.note.getLabelValue("shareOpenGraphDomain");
%> %>
<title><%= pageTitle %></title> <title><%= pageTitle %></title>
<style>#site-header .theme-selection{display:none}</style>
<% if (pageUrl) { %><link rel="canonical" href="<%= pageUrl %>"><% } %> <% if (pageUrl) { %><link rel="canonical" href="<%= pageUrl %>"><% } %>
<script> <script>
// Load dark/light theme as soon as possible to avoid color flashes. // Theme is fixed to dark light/dark switching is disabled.
let theme = localStorage.getItem("theme"); const theme = "dark";
if (!theme) {
theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light";
}
document.documentElement.classList.add(`theme-${theme}`); document.documentElement.classList.add(`theme-${theme}`);
window.glob = { window.glob = {