Skip to content
New issue

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

feat(dark-mode): implement dark mode and centralize CSS in WebUI #1014

Merged
merged 6 commits into from
Apr 20, 2024

Conversation

skrashevich
Copy link
Contributor

@skrashevich skrashevich commented Mar 22, 2024

image

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, and log.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 within main.js.

Furthermore, the PR adds a comprehensive dark mode feature across the website. Two key additions facilitate this:

  1. A toggle button (🌙 for dark mode and ☀️ for light mode) is introduced in the navigation. This button allows users to switch between light and dark themes.
  2. CSS definitions for dark mode styling are included, targeting various elements such as the body background, text color, navigation, tables, buttons, inputs, and placeholders. This ensures a consistent look and feel when dark mode is activated.

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 using localStorage, 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.

Implemented a dark mode feature for the website, including a toggle button in the navigation bar that allows users to switch between light and dark themes. To support this feature, centralized common CSS styles (such as body, table, and button stylings) into main.js to ensure consistent application across all HTML pages. This change improves user experience by providing a visually comfortable alternative for low-light environments and centralizes styling rules for easier maintenance.

- Added dark mode styles for body, table, buttons, and navigation elements in main.js.
- Introduced a toggle mechanism in the navigation bar to switch between light and dark modes.
- Utilized JavaScript to detect system theme preference (`prefers-color-scheme`) and persist user's theme choice using localStorage.
- Removed duplicate and scattered CSS rules from individual HTML files (add.html, index.html, links.html, log.html) and centralized them in main.js to reduce redundancy and facilitate easier updates in the future.

This update enhances accessibility and user preference compliance by allowing users to select their desired theme while simplifying CSS management across the website.
This commit improves the visibility and aesthetics of form elements (input, select, textarea) and horizontal rules (hr) in dark mode by adjusting their styles. Specifically, it sets a darker background color, lighter text color, and modifies border colors to ensure these elements are both visually appealing and easily distinguishable against the dark background. Additionally, placeholder text color has been adjusted to maintain readability without being overly prominent.

The removal of a fixed width on the navigation bar (`nav`) style is aimed at enhancing responsiveness and flexibility in various screen sizes, promoting a better user experience across devices.

These changes contribute to a more cohesive and accessible dark mode theme, aligning with modern web design practices that prioritize user comfort and interface adaptability.
@AlexxIT AlexxIT merged commit fcfef30 into AlexxIT:master Apr 20, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 20, 2024

Thanks!

@AlexxIT AlexxIT added this to the v1.9.0 milestone Apr 28, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 30, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants