Skip to content

Add Dark Mode Support with Three-State Theme Toggle#78

Merged
chriselsen merged 2 commits intomasterfrom
dark-mode
Feb 17, 2026
Merged

Add Dark Mode Support with Three-State Theme Toggle#78
chriselsen merged 2 commits intomasterfrom
dark-mode

Conversation

@chriselsen
Copy link
Member

Overview

Implements dark mode support for the Jekyll website with a three-state theme toggle (auto/light/dark) that respects OS preferences and persists user choice across sessions.

Changes

Theme Toggle System

  • Three-state palette system: Auto → Light → Dark → Auto
    • Auto mode respects OS prefers-color-scheme preference
    • Light mode forces light theme
    • Dark mode forces dark theme
  • Persistent storage: User preference saved in localStorage
  • Dynamic logo swapping: Automatically switches between edgecloud.png (light) and edgecloud-dark.png (dark)
  • OS theme change listener: Responds to system theme changes in auto mode
  • FOUC prevention: Inline script in <head> applies theme before page render

Dark Mode Styling

  • Responsive font sizes: Applied consistent 12px-18px scaling to dark theme
  • Masthead: Dark background for header in dark mode
  • Icons: FontAwesome and SVG icons inherit text color for proper visibility
  • Images: White background with padding for content images to ensure diagrams are visible
  • Search elements: Themed search toggle and input box
  • Theme toggle button: White color in dark mode to match other header elements

Files Modified

  • assets/js/theme.js: Theme toggle logic with three-state system
  • assets/css/dark.scss: Dark theme stylesheet with responsive typography
  • _includes/head/custom.html: FOUC prevention script
  • _includes/masthead.html: Theme toggle button with three icons
  • _sass/minimal-mistakes/_theme-toggle.scss: Theme toggle button styling
  • _config.yml: Logo configuration
  • assets/images/edgecloud-dark.png: Dark mode logo variant
  • _includes/search/algolia-search-scripts.html: Upgraded to InstantSearch.js v2.10.4

Algolia Search Upgrade

  • Upgraded InstantSearch.js from v2.3.3 to v2.10.4 for better stability

Known Issues

  • Algolia search box icons (magnifier and reset X) do not adapt to theme colors due to inline styles in the Algolia library that cannot be overridden
  • "Powered by Algolia" link text color in dark mode remains dark blue (low priority cosmetic issue)

Testing

  • Theme toggle cycles through all three states
  • Theme preference persists across page navigation
  • Logo swaps correctly between light and dark variants
  • OS theme changes are detected in auto mode
  • No flash of unstyled content on page load
  • All icons and text visible in both themes
  • Search functionality works in both themes

- Add three-state theme toggle (auto/light/dark) following mkdocs-material pattern
- Support automatic OS-based theme switching with prefers-color-scheme
- Apply responsive font sizes to dark theme
- Fix masthead background color in dark mode
- Force FontAwesome icons to inherit color in dark mode
- Create and swap dark logo version (white text) automatically
- Override SVG colors to use currentColor in dark mode
- Add white background to content images for visibility in dark mode
- Fix search icon color to white in dark mode
- Remove focus outline from theme toggle button
- Add tooltips showing next action on theme toggle hover
- Fix theme toggle reliability across page navigation
@chriselsen chriselsen merged commit f3d6cba into master Feb 17, 2026
@chriselsen chriselsen deleted the dark-mode branch February 17, 2026 06:57
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.

1 participant