1
0
mirror of https://github.com/Damillora/Yuika synced 2024-11-14 22:07:32 +00:00
Yuika/assets/js/dark-mode.js
Damillora 9f72b03781 feat(theme): add dark mode
With version 3, Yuika now uses Shian as a basis of styling. Since
Shian was written with both light and dark themes in mind, this
means that the theme now is able to support switching between them.

This commit implements a dark theme toggle that will switch the
site between light and dark themes.
2021-04-14 19:38:23 +07:00

15 lines
526 B
JavaScript

$(document).ready(function () {
$("#darkMode").click(function () {
if (window.document.body.getAttribute("data-theme") != "dark") {
window.document.body.setAttribute("data-theme", "dark");
$("#darkMode i").text("brightness_high");
$("#darkMode p").text("Light Mode");
} else {
window.document.body.setAttribute("data-theme", "light");
$("#darkMode i").text("brightness_low");
$("#darkMode p").text("Dark Mode");
}
})
});