mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 10:27:45 +02:00
Make theme key accessible via CSS
This commit is contained in:
parent
a6382b2e1d
commit
b294839b79
@ -683,6 +683,7 @@ async function changeTheme(key, onChanged) {
|
|||||||
.appendTo(document.head);
|
.appendTo(document.head);
|
||||||
|
|
||||||
themeStyleElem.html(newThemeStyle);
|
themeStyleElem.html(newThemeStyle);
|
||||||
|
document.documentElement.setAttribute("data-theme", key);
|
||||||
document.documentElement.setAttribute("data-scheme", response.headers.get("X-Scheme"));
|
document.documentElement.setAttribute("data-scheme", response.headers.get("X-Scheme"));
|
||||||
typeof onChanged == "function" && onChanged();
|
typeof onChanged == "function" && onChanged();
|
||||||
setTimeout(() => { tempStyle.remove(); }, 10);
|
setTimeout(() => { tempStyle.remove(); }, 10);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" id="top" data-scheme="{{ if .Request.Theme.Light }}light{{ else }}dark{{ end }}">
|
<html lang="en" id="top" data-theme="{{ .Request.Theme.Key }}" data-scheme="{{ if .Request.Theme.Light }}light{{ else }}dark{{ end }}">
|
||||||
<head>
|
<head>
|
||||||
{{ block "document-head-before" . }}{{ end }}
|
{{ block "document-head-before" . }}{{ end }}
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user