Skip to content

Commit 55681ab

Browse files
authored
Merge pull request #1173 from SuhainaFathimaM/main
Added Dark mode
2 parents 1f5190f + 3751fa7 commit 55681ab

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

Website/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" width="25" height="25"> <!-- GitHub Icon -->
2828
</a>
2929
</li>
30+
<li>
31+
<button id="toggle-dark-mode">
32+
<i class="fas fa-moon"></i>
33+
</button>
34+
</li>
3035
</ul>
3136
</nav>
3237
</header>

Website/js/script.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,13 @@ document.addEventListener("DOMContentLoaded", function() {
305305
}
306306
});
307307

308+
const toggleDarkModeButton = document.getElementById('toggle-dark-mode');
309+
const body = document.body;
310+
311+
toggleDarkModeButton.addEventListener('click', () => {
312+
body.classList.toggle('dark-mode');
313+
// Change icon based on dark mode status
314+
const icon = toggleDarkModeButton.querySelector('i');
315+
icon.classList.toggle('fa-moon');
316+
icon.classList.toggle('fa-sun');
317+
});

Website/styles.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,72 @@ button#toggle-languages:hover {
658658
opacity: 0.9;
659659
}
660660

661+
/* Dark Mode Styles */
662+
body.dark-mode {
663+
background-color: #121245;
664+
color: #f1f1f1;
665+
}
666+
667+
.dark-mode .navbar {
668+
background-color: #000;
669+
}
670+
671+
.dark-mode .nav-links a {
672+
color: #fff;
673+
}
674+
675+
.dark-mode .welcome-title {
676+
color: #fff;
677+
}
678+
679+
.dark-mode .highlight {
680+
color: #fff;
681+
}
682+
683+
.dark-mode .stat-card {
684+
background-color: #212148;
685+
}
686+
687+
.dark-mode .stat-card h3 {
688+
color: #fff;
689+
}
690+
691+
.dark-mode .stat-card p {
692+
color: rgb(255, 213, 98);
693+
}
694+
695+
.dark-mode .stat-icon {
696+
color: #fff;
697+
}
698+
699+
.dark-mode .stat-card:hover {
700+
background-color: #151537;
701+
}
702+
703+
.dark-mode .stat-card:hover .stat-icon{
704+
color: #fff;
705+
}
706+
707+
708+
#toggle-dark-mode {
709+
background: none;
710+
border: none;
711+
color: #f1f1f1;
712+
cursor: pointer;
713+
font-size: 1.2em;
714+
transition: color 0.3s ease;
715+
}
716+
717+
.dark-mode .welcome-section a{
718+
color: #cfd9e5;
719+
}
720+
721+
#toggle-dark-mode i {
722+
font-size: 1.5em;
723+
}
724+
725+
#toggle-dark-mode:hover {
726+
color: #fff;
727+
}
728+
729+

0 commit comments

Comments
 (0)