From e4d1f8bb307cdf3198421cfb7ae6c59bcad73003 Mon Sep 17 00:00:00 2001 From: Varun Bisoi Date: Mon, 13 Jul 2026 23:53:07 +0530 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=93=A6=20[Theme=20Add]=20fixed=20ligh?= =?UTF-8?q?t/dark=20toggle=20switch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cart.html | 10 ---------- css/style.css | 26 +++----------------------- js/main.js | 14 -------------- js/theme.js | 18 ++++++++++++++++++ orders.html | 8 -------- 5 files changed, 21 insertions(+), 55 deletions(-) create mode 100644 js/theme.js diff --git a/cart.html b/cart.html index 7638139..947bbe8 100644 --- a/cart.html +++ b/cart.html @@ -263,16 +263,6 @@

Contact Us

window.cartManager.subscribe(renderCart); - - - - - - - - - - diff --git a/css/style.css b/css/style.css index 9a3ad1e..893c6f2 100644 --- a/css/style.css +++ b/css/style.css @@ -2611,8 +2611,8 @@ body.dark p{ /* Header & Navigation */ body.dark header { - background: #2c2c2c; - box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6); + /* Keep orange brand background — only deepen the shadow for dark mode depth */ + box-shadow: 0 3px 14px rgba(0, 0, 0, 0.55); } body.dark nav a { color: #f5f5f5; @@ -2960,27 +2960,7 @@ select:focus-visible { } } -/* Dark mode support for better contrast */ -@media (prefers-color-scheme: light) { - body { - background: #1a1a1a; - color: #e0e0e0; - } - - .card { - background: #2d2d2d; - } - - .suggestion-item { - background: #2d2d2d; - color: #e0e0e0; - } - - .suggestion-item.focused { - background: #bf360c; - color: #fff; - } -} +/* Note: theme switching is handled via body.dark class (see auth.js setupThemeToggle) */ /* Improve contrast of disabled buttons */ diff --git a/js/main.js b/js/main.js index 3f7292d..8327b5e 100644 --- a/js/main.js +++ b/js/main.js @@ -1550,19 +1550,5 @@ function showSkeletonCartItems(count = 2) { for (let i = 0; i < count; i++) cartItemsContainer.appendChild(createSkeletonCartItem()); } -// ===== Dark Mode ===== -const toggleBtn = document.getElementById("theme-toggle"); -document.addEventListener("DOMContentLoaded", () => { - if (localStorage.getItem("theme") === "dark") { - document.body.classList.add("dark"); - } -}); - -if (toggleBtn) { - toggleBtn.addEventListener("click", () => { - document.body.classList.toggle("dark"); - localStorage.setItem("theme", document.body.classList.contains("dark") ? "dark" : "light"); - }); -} diff --git a/js/theme.js b/js/theme.js new file mode 100644 index 0000000..d9e6cda --- /dev/null +++ b/js/theme.js @@ -0,0 +1,18 @@ +// ===== Theme Toggle (standalone — for pages that don't load main.js) ===== +document.addEventListener("DOMContentLoaded", () => { + // Restore saved theme on page load + if (localStorage.getItem("theme") === "dark") { + document.body.classList.add("dark"); + } + + const toggleBtn = document.getElementById("theme-toggle"); + if (toggleBtn) { + toggleBtn.addEventListener("click", () => { + document.body.classList.toggle("dark"); + localStorage.setItem( + "theme", + document.body.classList.contains("dark") ? "dark" : "light" + ); + }); + } +}); diff --git a/orders.html b/orders.html index 932d146..ecff3cf 100644 --- a/orders.html +++ b/orders.html @@ -411,14 +411,6 @@

Have a promo cod - - - - - - - -