Theme Management Context Bridge

Securely exposes theme control functionality to the renderer process through Electron's contextBridge API, maintaining proper process isolation.

This module creates a controlled, secure API surface that allows the web-based renderer to access theme capabilities without compromising security. The exposed 'themeMode' global object provides a comprehensive interface for theme management while preventing direct access to Node.js APIs.

The exposed API enables the renderer to:

  • Detect the current theme setting (dark/light/system)
  • Toggle between light and dark modes directly
  • Force specific theme modes regardless of system settings
  • Synchronize with the system's theme preference

Each method communicates through predefined IPC channels, creating a secure boundary between renderer and main processes while enabling seamless theme integration.

Functions

exposeThemeContext