From 1db1172f22b6a7a5a1a39d5ed311b29412b6ac03 Mon Sep 17 00:00:00 2001 From: srivani vinnakota <164530944+sv410@users.noreply.github.com> Date: Sat, 19 Oct 2024 07:48:55 +0530 Subject: [PATCH] Create darklight.js --- darklight.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 darklight.js diff --git a/darklight.js b/darklight.js new file mode 100644 index 00000000..ab713444 --- /dev/null +++ b/darklight.js @@ -0,0 +1,7 @@ +toggle_switch = document.querySelector('#dark-mode'); + +toggle_switch.addEventListener 'input', -> + label = @labels[0]; + body = document.body; + + body.dataset.darkMode = label.dataset.darkMode = @checked;