Skip to content

Commit

Permalink
dark mode by default added
Browse files Browse the repository at this point in the history
  • Loading branch information
bigsk1 committed Jun 30, 2024
1 parent 5f872cb commit 88fedbd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
.dark-mode {
--bg-color: #121212;
--text-color: #ffffff;
--primary-color: #646464;
--primary-color: #333333;
--secondary-color: #1e1e1e;
--border-color: #333333;
--shadow-color: rgba(255, 255, 255, 0.1);
Expand Down
11 changes: 11 additions & 0 deletions app/static/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ document.addEventListener("DOMContentLoaded", function() {
downloadButton.addEventListener('click', downloadHistory);

// Theme toggle functionality
function setDarkModeDefault() {
const isDarkMode = localStorage.getItem('darkMode');
if (isDarkMode === null) {
body.classList.add('dark-mode');
} else {
body.classList.toggle('dark-mode', isDarkMode === 'true');
}
updateThemeIcon();
}

themeToggle.addEventListener('click', function() {
body.classList.toggle('dark-mode');
updateThemeIcon();
Expand All @@ -228,4 +238,5 @@ document.addEventListener("DOMContentLoaded", function() {
}

loadThemePreference();
setDarkModeDefault();
});

0 comments on commit 88fedbd

Please sign in to comment.