Skip to content

Conversation

@jainal09
Copy link
Contributor

@jainal09 jainal09 commented Sep 25, 2025

Summary

Implements a complete dark mode feature for grpcui with a toggle switch that allows users to seamlessly switch between light and dark themes.

All this time whenever I was working with your amazing tool, my eyes would pop out whenever I would switch tabs from dark theme of my editor to my browser to test my GRPC server. So, I thought I need dark mode ASAP!

Hope this helps others like me!

Features

  • Dark mode toggle switch with accessibility features (ARIA attributes, keyboard navigation)
  • localStorage persistence - remembers user preference across sessions
  • System preference detection - automatically respects prefers-color-scheme media query
  • Professional color scheme inspired by GitHub's dark theme
  • Comprehensive styling for all UI elements including:
    • Form inputs, buttons, and controls
    • Tables, tabs, and response panels
    • Error messages and status indicators
    • jQuery UI datepicker/calendar widget
  • Accessibility compliant with proper contrast ratios
  • Cross-browser compatibility

Implementation Details

  • Added toggle switch UI in webform-template.html
  • Implemented theme management JavaScript in webform.js
  • Extended CSS with comprehensive dark mode styles in webform-sample.css
  • Uses CSS custom properties for maintainable theming
  • Follows existing code patterns and conventions

Testing

Tested comprehensively with the KitchenSink test server to ensure all UI elements (including calendar widgets with timestamp fields) render correctly in both light and dark modes.

Screenshots

The implementation provides a professional dark theme that matches modern UI expectations while maintaining full functionality and accessibility.

image image image image

Light Mode stays as it is

image

jgosaliya added 2 commits September 25, 2025 03:29
- Add dark mode toggle switch in webform template with accessibility features
  - Implement localStorage persistence and system preference detection
  - Apply professional GitHub-inspired dark color scheme
  - Add comprehensive dark mode CSS for all UI elements including:
    - Form inputs, buttons, and controls
    - Tables, tabs, and response panels
    - Error messages and status indicators
    - jQuery UI datepicker/calendar widget
  - Ensure proper contrast ratios for accessibility
  - Maintain cross-browser compatibility
@jainal09
Copy link
Contributor Author

jainal09 commented Sep 28, 2025

@gpassini @dragonsinth @jhump @n0v1

Hi! I know u guys might be busy, but I would much appreciate a review as per your earliest convivence!

Cheers 🥂!

@dragonsinth
Copy link
Member

@jainal09 honestly this is a bit much... I think we could accept a pure-CSS change using light-dark() to simply respect the browser/device preference. But the UI toggle, javascript, and cookie storage is just kind of overkill.

@jainal09
Copy link
Contributor Author

@dragonsinth , Thank you for the feedback! I understand the concern about complexity, but
I'd like to address a key usability issue with a pure CSS-only approach.

The Problem:

  • Pure CSS light-dark() only respects system preferences with no override
    capability
  • So, If users want to use a different theme than their system setting, they
    have no way to do so.
  • We can keep a pure css toggle without local storage but Without any persistence, users would have to manually toggle the theme
    on every page refresh, which creates a poor user experience

So, I propose we find a middle ground approach:

  • We replace the complex toggle switch with a simple sun/moon icon button.
  • We keep minimal localStorage (just one key) for theme preference - this is
    essential UX
  • We also significantly simplify the JavaScript (remove system preference change
    listeners, complex state management)
  • use light-dark() CSS as the base with simple override classes
  • So, By default if there is no darkmode switch ever done, we still respect system preferences but allow
    users to override and remember their choice.

The localStorage is really the minimum viable functionality needed. Modern
web users expect their theme choice to persist, and it's just a single
localStorage key. Without it, the feature becomes more of a frustration
than a benefit.

Would this simplified approach with minimal persistence be acceptable?

@jainal09
Copy link
Contributor Author

jainal09 commented Sep 29, 2025

I made some changes and this is how it will look like if you approve it
image
image

This looks minimal and not too overkill

You can check the latest push for the new code changes. If you still dont like it I am open to make it to just system theme preference dependent. But I feel like this should address your concerns. @dragonsinth

  - Replace complex toggle switch with intuitive sun/moon icon button
  - Implement minimal localStorage persistence for user preference
  - Add system preference detection as fallback using prefers-color-scheme
  - Apply GitHub-inspired dark color scheme with proper contrast ratios
  - Position theme toggle on viewport edge to prevent layout issues
  - Reduce JavaScript complexity from ~75 to ~25 lines of code
  - Maintain cross-browser compatibility and accessibility standards

  Addresses maintainer feedback about implementation complexity while
  preserving essential UX functionality for voluntary theme switching.
@jainal09
Copy link
Contributor Author

jainal09 commented Nov 7, 2025

@dragonsinth just checking in. If you have any updates for me. LMK what is your thoughts on my recent changes: middle ground approach

@dragonsinth
Copy link
Member

I'm a fan of the pure-CSS, system-settings approach.

Replace JavaScript-based theme toggle with automatic dark mode detection
using CSS media queries. The UI now respects system preferences without
requiring user interaction or JavaScript.

- Remove theme toggle button and related UI elements
- Convert class-based dark mode (.grpc-theme-dark) to @media (prefers-color-scheme: dark)
- Remove initTheme() function and all theme switching JavaScript
- Remove localStorage theme persistence
- Improve type label visibility in dark mode (color: #c9d1d9)
- Add dark mode support for all UI elements including jQuery UI datepicker
- Simplify CSS selectors by removing theme-related classes

BREAKING CHANGE: Theme toggle button removed. Dark mode now follows system settings only.
@jainal09
Copy link
Contributor Author

jainal09 commented Nov 8, 2025

@dragonsinth done. Removed all custom js and UI button and implemented a pure CSS based darkmode that detects from system settings and applies the dark mode theme!

Copy link
Member

@dragonsinth dragonsinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dragonsinth dragonsinth enabled auto-merge (squash) November 11, 2025 15:43
@dragonsinth dragonsinth merged commit 9b944d6 into fullstorydev:master Nov 11, 2025
2 checks passed
@jainal09 jainal09 deleted the feature/dark-mode-implementation branch November 11, 2025 17:50
zerojulian pushed a commit to zeroflucs-given/grpcui that referenced this pull request Nov 20, 2025
Implements light vs. dark mode using CSS device query.
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.

2 participants