mirror of
https://github.com/its-michaelroy/Simple_Portfolio.git
synced 2026-06-03 23:00:43 +00:00
Added Dark Mode and working on color scheme
This commit is contained in:
@@ -146,6 +146,31 @@ mark {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#theme-toggle {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.fa-sun {
|
||||
color: #ffc107;
|
||||
}
|
||||
|
||||
.fa-moon {
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
.dark-mode {
|
||||
background-color: #222;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.dark-mode a {
|
||||
color: #49bf9d;
|
||||
}
|
||||
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
@@ -172,6 +197,10 @@ html {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
19
assets/js/darkmode.js
Normal file
19
assets/js/darkmode.js
Normal file
@@ -0,0 +1,19 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const body = document.body;
|
||||
const themeToggle = document.getElementById("theme-toggle");
|
||||
|
||||
themeToggle.addEventListener("click", function () {
|
||||
body.classList.toggle("dark-mode");
|
||||
toggleThemeIcon();
|
||||
});
|
||||
|
||||
function toggleThemeIcon() {
|
||||
if (body.classList.contains("dark-mode")) {
|
||||
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
|
||||
} else {
|
||||
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
|
||||
}
|
||||
}
|
||||
|
||||
toggleThemeIcon(); // Set initial icon based on the current theme
|
||||
});
|
||||
14
assets/js/fullparagrph.js
Normal file
14
assets/js/fullparagrph.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function toggleParagraph() {
|
||||
var spans = document.querySelectorAll("#more");
|
||||
var btnText = document.querySelector(".learn-more");
|
||||
|
||||
spans.forEach(function (span) {
|
||||
span.classList.toggle("hidden");
|
||||
});
|
||||
|
||||
if (spans[0].classList.contains("hidden")) {
|
||||
btnText.textContent = "Learn More";
|
||||
} else {
|
||||
btnText.textContent = "Less";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user