mirror of
https://github.com/meta-llama/llama-stack.git
synced 2026-01-01 10:34:31 +00:00
adding some js to detect current browser theme
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
19b5656083
commit
026ce73ef8
2 changed files with 10 additions and 0 deletions
9
docs/_static/js/detect_theme.js
vendored
Normal file
9
docs/_static/js/detect_theme.js
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
const htmlElement = document.documentElement;
|
||||
if (prefersDark) {
|
||||
htmlElement.setAttribute("data-theme", "dark");
|
||||
} else {
|
||||
htmlElement.setAttribute("data-theme", "light");
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue