mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
feat(ui): introducing dark-mode and refactor some template details and css
- chore: increase to 9.7.0 - reconcile with main after rebase - chore: reconcile fixes to containers.twig from main after rebase - refactor(layout): increment CSS version from v2 to v3 Signed-off-by: ernolf <raphael.gradenwitz@googlemail.com>
This commit is contained in:
parent
10495fd56e
commit
1f144b9ee7
13 changed files with 988 additions and 727 deletions
26
php/public/toggle-dark-mode.js
Normal file
26
php/public/toggle-dark-mode.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Function to toggle theme
|
||||
function toggleTheme() {
|
||||
const currentTheme = document.documentElement.getAttribute('data-theme');
|
||||
const newTheme = (currentTheme === 'dark') ? 'light' : 'dark';
|
||||
document.documentElement.setAttribute('data-theme', newTheme);
|
||||
localStorage.setItem('theme', newTheme);
|
||||
|
||||
// Change the icon based on the current theme
|
||||
const themeIcon = document.getElementById('theme-icon');
|
||||
themeIcon.textContent = newTheme === 'dark' ? '☀️' : '🌙'; // Switch between moon and sun icons
|
||||
}
|
||||
|
||||
// Function to apply saved theme from localStorage
|
||||
function applySavedTheme() {
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
if (savedTheme) {
|
||||
document.documentElement.setAttribute('data-theme', savedTheme);
|
||||
|
||||
// Ensure the icon is set correctly based on the saved theme
|
||||
const themeIcon = document.getElementById('theme-icon');
|
||||
themeIcon.textContent = savedTheme === 'dark' ? '☀️' : '🌙';
|
||||
}
|
||||
}
|
||||
|
||||
// Apply theme when the page loads
|
||||
document.addEventListener('DOMContentLoaded', applySavedTheme);
|
||||
Loading…
Add table
Add a link
Reference in a new issue