From 725031f3925129a81c98d8b1447022b4ef14c5bc Mon Sep 17 00:00:00 2001
From: Rudrakhsa Dwivedi <146867502+Rudraksha-007@users.noreply.github.com>
Date: Wed, 18 Dec 2024 00:12:08 +0530
Subject: [PATCH] Tried implementing automatic dark mode theme

Dear Godfather,
this is King Terry the terrible,
The absence of automatic theme switching was a major problem for me since I use light theme at daytime and vice versa so i took matter into me own hands
regards,
King Terry the terrible.
---
 src/utils/theme.ts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/utils/theme.ts b/src/utils/theme.ts
index 195f18e..52f3958 100644
--- a/src/utils/theme.ts
+++ b/src/utils/theme.ts
@@ -1,6 +1,10 @@
 export function initializeTheme(): void {
     chrome.storage.local.get(['isDarkTheme'], (result) => {
         const theme = result.isDarkTheme ? 'dark' : 'light';
+        const current_Time=new Date().getHours();
+        const isDarkTheme=current_Time>=16 || current_Time<6;//i want the extension to change theme automatically to stay consistent with me laptop 
+        //avg sunsets across India seems to be about 4PM since its dec. 
+        //i dont know much about Typescript sorry if i am polluting the code base in anyway (apologies init)
         document.documentElement.setAttribute('data-theme', theme);
         updateThemeUI(theme); // Make sure this function adjusts the UI correctly
     });
@@ -29,4 +33,4 @@ function updateThemeUI(theme: string) {
         themeIcon.textContent = '🌙';
         themeText.textContent = 'Dark Mode';
     }
-}
\ No newline at end of file
+}