Custom Themes for Electron Desktop Apps: A Hands-On Guide

    This guide explains why most AI desktop clients can be re-skinned—they're built on Electron, where the UI is essentially a web page. It walks through verifying Electron via DevTools, compares two theming approaches (modifying the app.asar archive vs. injecting CSS via the Chrome DevTools Protocol), and presents a practical launcher-script solution that auto-injects custom CSS on every startup, plus tips for safe, maintainable customization.

    1. Why Can Desktop AI Clients Be Re-Skinned?

    Re-skinning AI agent desktop clients has become a trend lately—everything from chat panel colors to the overall visual style can be deeply customized, and paid customization services have even emerged. This isn’t some secret hack; once you understand the underlying mechanism, anyone can do it themselves.

    The reason is simple: the vast majority of AI chat clients and agent-style desktop tools, on both Windows and macOS, are built on Electron.

    Electron can be broken down into three layers:

    1. Chromium rendering layer: handles UI rendering—your entire app window is essentially a browser page;
    2. Node.js runtime: provides system capabilities like file system access and process management;
    3. Native bridge layer: connects JavaScript with operating system capabilities.

    Since the interface is fundamentally a web page, every CSS customization technique that works on the web also applies to these clients. This is the fundamental reason why re-skinning is possible.

    2. Step One: Open Developer Tools

    On macOS, open any Electron-based app and press:

    1. Command + Option + I

    On Windows, it’s usually Ctrl + Shift + I.

    If the shortcut works, the app has kept its DevTools entry point, and you can inspect elements, view styles, and modify CSS just like debugging a web page—with real-time previews. This is also a quick way to verify whether an app “can be re-skinned.” Alternatively, you can simply ask an AI assistant whether the app is built on Electron.

    3. Two Mainstream Theming Approaches Compared

    Approach 1: Directly Modify the Archived Resource Files Inside the Package

    An Electron app’s UI resources are usually packed in an archive file like app.asar. The basic workflow:

    1. # Unpack
    2. npx asar extract app.asar ./app
    3. # Modify the style files (e.g., inject custom CSS or override theme variables)
    4. # Repack
    5. npx asar pack ./app app.asar

    Pros: Changes are persistent and take effect on launch, with no external tools required.

    Cons:

    • Every automatic app update overwrites the package, wiping out your changes;
    • Editing the wrong file can prevent the app from launching;
    • Repackaging and distributing the modified app to others may raise compliance issues.

    Approach 2: Inject Custom CSS via DevTools (CDP Injection)

    Connect to the app’s page through the Chrome DevTools Protocol (CDP) and inject styles dynamically, for example:

    1. const style = document.createElement('style');
    2. style.textContent = `
    3. :root {
    4. --bg-primary: #1a1b26;
    5. --text-primary: #a9b1d6;
    6. }
    7. body { background: var(--bg-primary) !important; }
    8. `;
    9. document.head.appendChild(style);

    Pros: Doesn’t touch the original files—safe, reversible, and lets you switch themes anytime.

    Cons: Changes are lost after restart and must be re-injected each time.

    4. The Middle Ground: A Launcher Script That Auto-Injects

    Combining the strengths of both approaches, the most practical solution is a third one: write a launcher script that opens the app and automatically injects your CSS every time.

    The idea:

    1. Launch the target app in remote debugging mode, for example:
      1. /Applications/YourApp.app/Contents/MacOS/YourApp --remote-debugging-port=9222
    2. Connect to that port via the CDP interface and retrieve the list of page targets;
    3. Execute Runtime.evaluate on the target page to inject your theme CSS;
    4. Wrap it all into a script with theme files stored separately—switching styles only means editing the CSS file.
    1. // Pseudocode
    2. const targets = await fetch('http://127.0.0.1:9222/json');
    3. for (const t of targets) {
    4. await cdpEvaluate(t.webSocketDebuggerUrl, injectCss(themeCss));
    5. }

    This approach combines persistence (automatically applied on every launch) with safety (the app itself is never modified), and it’s highly portable across both Windows and macOS.

    5. Practical Tips

    1. Start shallow, then go deeper: begin with surface-level variables like background colors, border radii, and fonts; move on to layout adjustments once you’re familiar with the DOM structure;
    2. Collaborate with AI: the process may take a dozen or more rounds of conversation with an AI assistant—use it to analyze page structure, generate CSS, and troubleshoot broken selectors;
    3. Watch for update compatibility: app updates may change the DOM structure, so make your selectors fault-tolerant;
    4. Stay within bounds: personal customization for your own use is fine, but don’t modify and redistribute someone else’s software packages for commercial purposes—that carries infringement risks.

    6. Conclusion

    So-called “custom skin services” are essentially built on a general technical fact—Electron apps are debuggable and injectable on the front end—plus an information gap. Master the trio of DevTools debugging, the asar structure, and CDP injection, and you can build your own exclusive themed interface for free. The technology itself isn’t complicated. Give it a try and enjoy the process.