-
Notifications
You must be signed in to change notification settings - Fork 285
Added more feature in "Dark Mode". i.e. Scheduling Dark Mode #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I made changes and also worked on this further.
|
@prem-k-r and @Thunder-Blaze. |
Hi Rohan, can you please move all newly added code in script.js to dark-mode.js |
I will make a new dark mode file, and move that block of code to that file. |
Not like that. in dark-mode.js
also html and css part here can be moved to index.html and style.css |
I made the new dark-mode.js file and |
See the working 2025-01-25.22-03-34.mp4 |
Yes, it working, Great work! |
Yeah I thought same but I didn't tested it so idk if they are for same purpose or not |
Hi Prem. https://github.com/Coderxrohan/materialYouNewTab/blob/main/scripts/dark-mode.jsHave a look at it and suggest any changes, please! |
Ok |
Just need to check if it works properly on the firefox browser.... |
I have tested it on Firefox, working normally. |
fine then... |
Actually, #284 was before the dark mode toogle, it was to switch between light theme and black theme. We will be removing dark mode toggle from there to place near color palatte without text.
not really, like if someone want to edit in between, |
As for code, you have html and css in js that can be easily move to resp. files and better to use function-based approach over class-based approach. code by chatgpt (need reworking and adjustment):
in dark-mode.js
in script.js nothing will be added |
Thanks for reviewing code. I will make changes myself and updates it. |
@prem-k-r wsup with this pr? |
It's a great idea, we can go ahead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- index.html: Language not supported
Comments suppressed due to low confidence (1)
scripts/script.js:1893
- There are multiple DOMContentLoaded event listeners binding similar functionality. Consider consolidating them into a single listener to avoid potential conflicts and duplicate event registrations.
document.addEventListener("DOMContentLoaded", () => {
if (!isDarkModeEnabled) { | ||
// If dark mode is disabled, disable scheduling | ||
scheduledDarkModeCheckbox.checked = false; | ||
localStorage.setItem("darkModeScheduled", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line stores a boolean value while the rest of the code compares against the string "true". Store the value as a string ("false") for consistency and to avoid potential mismatches.
localStorage.setItem("darkModeScheduled", false); | |
localStorage.setItem("darkModeScheduled", "false"); |
Copilot uses AI. Check for mistakes.
📝 Description
I have made changes to automate the dark mode. Means the user can be able to schedule the dark mode as his choice.
📸 Screenshots / 📹 Videos
Attached is the screenshot below.
🔗 Related Issues
✅ Checklist
[✅] I have read and followed the [Contributing Guidelines](https://github.com/XengShi/materialYouNewTab/


blob/main/CONTRIBUTING.md).
[✅] I have tested my changes by installing them as an extension (not just running via localhost) to ensure it builds, installs, and works as expected.
[✅] I have tested these changes in at least Chrome and Firefox (other browsers if applicable).
[✅] Attached visual evidence of changes (screenshots or videos), if applicable.