Skip to content

Commit 4c62b42

Browse files
committed
added dark mode
Signed-off-by: Vedansh Saini <[email protected]>
1 parent fc370c4 commit 4c62b42

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

src/icons/light-mode.png

731 Bytes
Loading

src/index.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,30 @@ li {
5454
list-style-type: disc !important;
5555
margin-left: 1rem;
5656
}
57+
58+
.dark-mode {
59+
background: #1a1a1a !important;
60+
color: #ffffff !important;
61+
}
62+
.dark-mode .bg-white{
63+
background-color: #2d2d2d !important;
64+
border-color: #404040 !important;
65+
}
66+
67+
.dark-mode input[type="text"],
68+
.dark-mode input[type="date"],
69+
.dark-mode #scrumReport {
70+
background-color: #404040 !important;
71+
border-color: #505050 !important;
72+
color: #ffffff !important;
73+
}
74+
.dark-mode h3,
75+
.dark-mode h4,
76+
.dark-mode p,
77+
.dark-mode label {
78+
color: #ffffff !important;
79+
}
80+
81+
.dark-mode hr {
82+
border-color: #505050 !important;
83+
}

src/popup.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
</style>
2020
</head>
2121
<body>
22-
<div class="pl-2 py-4 rounded-2xl">
23-
<div class="bg-white pl-4 py-4 mx-2 mb-2 rounded-3xl">
22+
<div class="pl-1 py-4 rounded-2xl">
23+
<div class="bg-white px-4 py-4 mx-4 mb-2 rounded-3xl">
2424
<div class="flex justify-between py-2">
2525
<h3 class="text-3xl font-semibold ">Scrum Helper</h3>
26-
<img src="icons/night-mode.png" alt="Night Mode" class="w-7 h-7 mx-3">
26+
<img src="icons/night-mode.png" alt="Night Mode" class="w-7 h-7 mx-3 cursor-pointer">
2727
</div>
2828
<div>
2929
<p class="font-semibold">SCRUM helper prefills the Scrums in google groups, with your FOSSASIA's contributions.</p>
@@ -41,7 +41,7 @@ <h3 class="text-3xl font-semibold ">Scrum Helper</h3>
4141
</div>
4242

4343
<div class="rounded-2xl">
44-
<div class=" border-gray-100 border-2 bg-white rounded-3xl pl-4 py-2 mx-2 my-2">
44+
<div class=" border-gray-100 border-2 bg-white rounded-3xl px-4 py-4 mx-4 my-2">
4545
<div>
4646
<h4>Your Project Name</h4>
4747
<input id="projectName" type="text" class="w-full border-2 border-gray-200 bg-gray-200 rounded-xl text-gray-800 p-2 my-2" placeholder="Enter your project name">

src/scripts/popup.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,27 @@ document.getElementById('customDateContainer').addEventListener('click', () => {
8080
// document.querySelectorAll('input[name="timeframe"]').forEach(radio => radio.checked = false);
8181
// document.getElementById('startingDate').disabled = false;
8282
// document.getElementById('endingDate').disabled = false;
83-
// });
83+
// });
84+
85+
document.addEventListener('DOMContentLoaded', function() {
86+
const darkModeToggle = document.querySelector('img[alt="Night Mode"]');
87+
const body = document.body;
88+
89+
chrome.storage.local.get(['darkMode'], function(result) {
90+
if(result.darkMode) {
91+
body.classList.add('dark-mode');
92+
darkModeToggle.src = 'icons/light-mode.png';
93+
}
94+
});
95+
96+
darkModeToggle.addEventListener('click', function() {
97+
body.classList.toggle('dark-mode');
98+
const isDarkMode = body.classList.contains('dark-mode');
99+
100+
// Save preference
101+
chrome.storage.local.set({ darkMode: isDarkMode });
102+
103+
// Toggle icon
104+
this.src = isDarkMode ? 'icons/light-mode.png' : 'icons/night-mode.png';
105+
});
106+
})

0 commit comments

Comments
 (0)