How mauuxl/whatsapp-dark-theme works
Main Components
• Manifest Configuration (manifest.json): Acts as the entry point by declaring the extension’s scripts, permissions, and UI configuration.
• Popup Module (popup folder):
• popup.html – the UI for the extension’s popup.
• popup.css – styling for the popup.
• popup.js – handles JavaScript logic for interactions in the popup interface.
• Content Scripts (scripts folder):
• content.js – dynamically injects or modifies the web page (in this case, WhatsApp Web) to apply the dark theme.
• Style Definitions (css folder):
• content.css – contains the CSS rules that define the dark theme styles.
• Additional Assets:
Relationships and Interactions
• The manifest.json defines which pages and scripts are loaded by the browser. It “connects” the popup interface and the content scripts.
• When the extension is loaded, the manifest tells the browser to inject content.js and/or css/content.css into the WhatsApp Web page for applying the dark theme.
• The popup component (HTML/CSS/JS in the popup folder) provides a user interface where users can interact with the extension—turning the theme on/off or accessing settings.
Architectural Patterns and Design Principles
• Modular structure: Separation of styling (css), logic (scripts and popup/js), assets (images), and configuration (manifest.json).
• Client-side injection: The key architectural pattern is that the extension injects CSS/JS into the host web app (WhatsApp Web) to alter its presentation.
• Clear separation between the extension’s own UI (popup) and the modifications applied to the target web page.