dark mode elements inline javascript
CI / testsuite (pgsql, 8.2, ) (push) Successful in 4m4s
CI / testsuite (mysql, 8.2, ) (push) Successful in 4m23s
CI / testsuite (mysql, 8.4, ) (push) Successful in 2m50s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m47s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 2m46s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 4m43s
Release / build (push) Successful in 10s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 4m46s
CI / Coding Standard & Static Analysis (push) Successful in 3m35s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 4m4s
CI / testsuite (mysql, 8.2, ) (push) Successful in 4m23s
CI / testsuite (mysql, 8.4, ) (push) Successful in 2m50s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m47s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 2m46s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 4m43s
Release / build (push) Successful in 10s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 4m46s
CI / Coding Standard & Static Analysis (push) Successful in 3m35s
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
*/
|
||||
|
||||
?>
|
||||
<script>
|
||||
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
||||
document.documentElement.classList.toggle(
|
||||
"dark",
|
||||
localStorage.theme === "dark" ||
|
||||
(!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches),
|
||||
);
|
||||
document.documentElement.classList.toggle(
|
||||
"auto",
|
||||
localStorage.theme === "auto"
|
||||
);
|
||||
// Whenever the user explicitly chooses light mode
|
||||
|
||||
// localStorage.theme = "light";
|
||||
// // Whenever the user explicitly chooses dark mode
|
||||
// localStorage.theme = "dark";
|
||||
// // Whenever the user explicitly chooses to respect the OS preference
|
||||
// localStorage.removeItem("theme");
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user