Skip to content
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

added night toggle functionality and javascript coding for that #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
3 changes: 3 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@media screen and (max-width:600px) {

}
29 changes: 26 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
<html lang="en">

<head>

<link rel="stylesheet" href="index.css">
<style>
@import url('https://fonts.googleapis.com/css?family=Nova+Round&display=swap');


* {
margin: 0;
padding: 0;
Expand Down Expand Up @@ -108,12 +109,26 @@
grid-area: 3 / 4 / 6 / 5;
}
</style>
<style>
/* Add some styles for night mode */
/* By Rahul */
body.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}

.calculator.dark-mode {
background-color: #2d2d2d;
}
</style>

</head>

<body>
<div class="nightModeToggle">
<div class="switch"></div>
<!-- Add an icon for the night mode toggle -->
<!-- by Rahul -->
<div class="nightModeToggle" style="margin-bottom: 1rem;">
<span class="icon" id="nightModeIcon" style="background-color: #5f657d; padding:0.2rem; border-radius: 1.5rem;">🌙</span>
</div>

<div class="calculator">
Expand Down Expand Up @@ -265,6 +280,14 @@
calculation.textContent = result.textContent;
});

// Add the night mode toggle functionality
// By Rahul
const nightModeToggle = document.querySelector('.nightModeToggle');
const body = document.body;

nightModeToggle.addEventListener('click', function () {
body.classList.toggle('dark-mode');
});
</script>
</body>

Expand Down