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

darkmode option #1113

Closed
Closed
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
3 changes: 3 additions & 0 deletions darkmode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function toggleDarkMode() {
document.body.classList.toggle('dark-mode');
}
Binary file added darkmodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark"></html>
<html lang="en">

<head>
Expand All @@ -21,6 +22,7 @@
<link rel="icon" href="./images/logo.png" type="image/png">

<!-- font awesome icons script -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>

Expand Down Expand Up @@ -85,6 +87,8 @@
<span class="i"><i class="fa fa-shopping-cart cart-icon" aria-hidden="true"></i> <span
class="no-of-cart-items">0</span></span>
</div>
<img src="./moon.png" id="icon" onclick="toggleDarkMode()" alt="Toggle Dark Mode">

<div class="icon">
<i class="fa fa-bars menu" aria-hidden="true" id="menu-icon"></i>
</div>
Expand Down Expand Up @@ -553,6 +557,7 @@ <h4>Newsletter</h4>
<script src="script/cursor.js"></script>
<script src="script/script.js"></script>
<script src="script/reviews.js"></script>
<script src="darkmode.js"></script>
</body>

</html>
Binary file added moon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added moons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,41 @@ body {
z-index: 9999;
}

/* Icon styling */
#icon {
width: 30px;
padding-left: 10px;
cursor: pointer; /* Makes the icon look clickable */
}

/* Default light mode styles */
body {
background-color: #ffffff;
color: #000000;
}

body {
background: linear-gradient(to right, #ffcccc, #ffe6e6); /* Adjust as per your color needs */
background-size: cover;
margin: 0;
padding: 0;
}
.container {
width: 100%;
max-width: 100%;
margin: 0 auto;
}
html, body {
overflow-x: hidden;
}


/* Dark mode styles */
body.dark-mode {
background-color: #121212;
color: #ffffff;
}


.loader-container {
position: relative;
Expand Down
Binary file added sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.