mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 10:54:19 +00:00
# What does this PR do? 1. Adding some lightweight JS to detect the default browser setting for dark/light mode 3. Setting default screen setting to light mode as to not change default behavior. From the docs: https://github.com/MrDogeBro/sphinx_rtd_dark_mode >This lets you choose which theme the user sees when they load the docs for the first time ever. After the first time however, this setting has no effect as the users preference is stored in local storage within their browser. This option accepts a boolean for the value. If this option is true (the default option), users will start in dark mode when first visiting the site. If this option is false, users will start in light mode when they first visit the site. # Closes #1915 ## Test Plan Tested locally on my Mac on Safari and Chrome. --------- Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
9 lines
334 B
JavaScript
9 lines
334 B
JavaScript
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");
|
|
}
|
|
});
|