feat(dark-mode): implement dark mode and centralize CSS in WebUI #1014
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request introduces significant changes to the styling and functionality of the web pages. Most notably, it performs a clean-up of repetitive CSS across multiple HTML files (
add.html
,index.html
,links.html
, andlog.html
) by removing duplicated style declarations. These styles were explicitly defining font families, background colors, and table styles directly within each HTML file. This redundancy is removed, and instead, the styling definitions are centralized and now reside withinmain.js
.Furthermore, the PR adds a comprehensive dark mode feature across the website. Two key additions facilitate this:
The implementation also respects the user's system preference for dark or light themes through the
prefers-color-scheme
media query, providing an adaptive and user-friendly experience. The dark mode state is persisted across sessions usinglocalStorage
, ensuring that users' preferences are remembered.Additionally, JavaScript logic is added to dynamically update the dark mode state and the Ace editor theme based on the user's selection or system preference. An event listener for the
DOMContentLoaded
event ensures that the dark mode toggle and theme are correctly initialized when the page loads.Overall, this Pull Request enhances the website's accessibility and user experience by introducing a much-requested dark mode feature and simplifying the CSS structure for easier maintenance and consistency across web pages.