We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
/* app.css */ /** Dark Theme **/ [data-theme="dark"] { --COLOR-BACKGROUND: #22272e; --COLOR-CODE-BG: #2d333b; --COLOR-TEXT: #adbac7; --COLOR-TEXT-300: #8d97a0; } [data-theme="dark"] .text-slate-800 { color: var(--COLOR-TEXT); } [data-theme="dark"] .btn-home { box-shadow: 0.1rem 0.1rem 0.5rem var(--COLOR-TEXT-300); } [data-theme="dark"] .component-container { background: var(--COLOR-CODE-BG); border-color: var(--COLOR-CODE-BG); } [data-theme="dark"] :is(.card, .grid, .modal, .stacked-list li) { color: var(--COLOR-BACKGROUND); } [data-theme="dark"] .badge-btn { color: var(--COLOR-TEXT); } [data-theme="dark"] :is(table, tr) { border-color: var(--COLOR-BACKGROUND); } [data-theme="dark"] tbody tr:nth-child(even) { background: var(--COLOR-BACKGROUND); }
// js/app.js const btnTheme = document.querySelector(".btn-theme"); const htmlElement = document.documentElement; const moonIcon = document.querySelector(".btn-theme .fa-moon"); btnTheme.addEventListener("click", () => { if (!htmlElement.hasAttribute("data-theme")) { htmlElement.setAttribute("data-theme", "dark"); localStorage.setItem("poshUITheme", "dark"); } else { htmlElement.removeAttribute("data-theme"); localStorage.removeItem("poshUITheme"); } moonIcon.classList.toggle("fas"); }); (() => { const theme = localStorage.getItem("poshUITheme"); if (theme) { htmlElement.setAttribute("data-theme", "dark"); moonIcon.classList.add("fas"); } })();
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently, the code does not check the users' default theme preference. It only allows toggling themes via the moon button on site. Using codes below,
And
Requirement
Add code to check user default theme preference
The text was updated successfully, but these errors were encountered: