Skip to content

bobum/schematics

Repository files navigation

Visual Connection Schematics - Dark Mode Feature

Overview

This project visualizes component connections and pin mappings with a beautiful, interactive interface. The dark mode feature provides users with a comfortable viewing experience in low-light environments.

Features

Dark Mode Implementation (DM-001)

  • Toggle Switch: Intuitive UI toggle in the header for switching between light and dark themes
  • Persistent Preference: User's theme choice is saved in localStorage and restored on page reload
  • Smooth Transitions: All theme changes animate smoothly with CSS transitions
  • Comprehensive Theming: All UI elements adapt to the selected theme using CSS variables

File Structure

.
├── index.html          # Main HTML structure with theme toggle UI
├── styles.css          # Complete CSS with light/dark theme variables
├── app.js              # Connection visualization logic
├── dark-mode.js        # Dark mode toggle functionality
└── README.md           # This file

How It Works

CSS Variables

The application uses CSS custom properties (variables) to manage theme colors:

Light Mode Colors:

  • Background gradients: Purple/blue tones (#667eea, #764ba2)
  • Card backgrounds: White
  • Text: Dark gray (#333, #666)

Dark Mode Colors:

  • Background gradients: Dark navy tones (#1a1a2e, #16213e)
  • Card backgrounds: Deep blue (#0f3460)
  • Text: Light gray (#e8e8e8, #b0b0b0)

JavaScript Functionality

The dark mode toggle:

  1. Checks localStorage for saved theme preference on page load
  2. Applies the saved theme immediately
  3. Listens for toggle switch clicks
  4. Updates the HTML data-theme attribute
  5. Saves the new preference to localStorage
  6. Updates toggle UI (icon and text)

Usage

For Users

  1. Click the theme toggle switch in the top-right corner
  2. The interface will smoothly transition between light and dark modes
  3. Your preference is automatically saved and will be remembered on your next visit

For Developers

Adding New Themed Elements:

.your-element {
  background: var(--card-bg);
  color: var(--text-primary);
}

Modifying Theme Colors: Edit the CSS variables in styles.css:

:root {
  --card-bg: white;  /* Light mode */
}

[data-theme="dark"] {
  --card-bg: #0f3460;  /* Dark mode */
}

Browser Compatibility

  • Modern browsers with CSS custom properties support
  • localStorage support required for preference persistence
  • Fallback to light mode if localStorage is unavailable

Testing

Manual Testing Checklist

  • Toggle switch changes visual state when clicked
  • Theme changes apply to all UI elements
  • Theme preference persists after page reload
  • Smooth transitions between themes
  • Responsive design works in both themes
  • Toggle UI updates correctly (icon and text)

Browser Testing

  • Chrome/Edge (Chromium)
  • Firefox
  • Safari
  • Mobile browsers

Accessibility

  • High contrast ratios maintained in both themes
  • User preference respected and persisted
  • Smooth transitions avoid jarring changes
  • Toggle is keyboard accessible

Future Enhancements

  • System theme detection (prefers-color-scheme)
  • Additional theme options (e.g., high contrast, custom colors)
  • Theme scheduling (auto-switch based on time)
  • Export/import theme preferences

Credits

Developed by the Frontend Developer Agent for feature DM-001 Branch: feature-dm-001

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published