Dark Mode

Professional dark theme with system-aware intelligence and manual override

Theme Selection

πŸŒ“
System
Follows OS preference
β˜€οΈ
Light
Always light theme
πŸŒ™
Dark
Always dark theme

Keyboard shortcut: ⌘ + Shift + D to toggle dark mode

Dynamic Color System

Colors automatically adjust for optimal contrast and readability in dark mode.

Primary
Success
Warning
Danger
Info
Surface
Elevated
Background

Component Showcase

Buttons

Form Elements

Card Component

Cards adapt their background and borders for perfect contrast in any theme.

Alert Messages

Success message
Warning message
Error message
Information message

Badges & Tags

Default Primary Success Warning Danger Info

Data Display

Feature Light Mode Dark Mode Status
Background #FFFFFF #000000 Optimized
Text Color #333333 #FFFFFF Optimized
Primary Color #ED8B00 #FF9500 Optimized
Border Color #DEDEDE #3A3A3C Optimized

Dark Mode Features

3
Theme Modes
100%
Coverage
AAA
WCAG Rating
200ms
Transition

🎨 Smart Color System

  • Automatic color inversion
  • Optimized contrast ratios
  • Preserved brand colors
  • Reduced eye strain

⚑ Performance

  • CSS-only implementation
  • Hardware accelerated
  • Smooth transitions
  • No layout shifts

πŸ”§ Developer Features

  • CSS custom properties
  • Media query support
  • JavaScript API
  • LocalStorage persistence

β™Ώ Accessibility

  • WCAG AAA compliant
  • Focus indicators
  • Keyboard shortcuts
  • Screen reader support

πŸ“± Platform Support

  • System preference detection
  • Mobile theme-color meta
  • PWA manifest support
  • Cross-browser compatible

🎯 User Experience

  • Remembers preference
  • Smooth animations
  • No flash on load
  • Manual override option

Implementation

Basic Usage

<!-- Auto-initialize with data attribute -->
<body data-dark-mode-toggle>
  <!-- Your content -->
</body>

<!-- Include the script -->
<script src="/src/js/dark-mode-toggle.js"></script>

JavaScript API

// Initialize manually
const darkMode = new DarkModeToggle({
  defaultTheme: 'system', // 'light', 'dark', 'system'
  showToggle: true,
  togglePosition: 'bottom-right',
  onChange: (state) => {
    console.log('Theme changed:', state);
  }
});

// API methods
darkMode.setTheme('dark');        // Set specific theme
darkMode.toggle();                 // Toggle between themes
darkMode.getTheme();              // Get current theme setting
darkMode.getEffectiveThemeValue(); // Get actual theme in use

CSS Variables

/* Use semantic color variables that adapt automatically */
.my-component {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

/* Check current theme in CSS */
:root[data-theme="dark"] .my-component {
  /* Dark mode specific styles */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .my-component {
    /* System dark mode styles */
  }
}

Typography in Dark Mode

Heading Level 1

Heading Level 2

Heading Level 3

Heading Level 4

Heading Level 5
Heading Level 6

This is a lead paragraph with larger text for emphasis. It adapts perfectly to dark mode with optimized contrast.

Regular paragraph text with inline links, bold text, italic text, and inline code. All typography elements are carefully tuned for readability in both light and dark themes.

"Dark mode isn't just about inverting colorsβ€”it's about creating a cohesive, comfortable viewing experience that reduces eye strain while maintaining visual hierarchy and brand identity."