Customize Electron Desktop App Themes with Custom CSS: A Step-by-Step Guide
This guide explains why many Electron-based desktop apps, including AI chat and agent clients, can be re-skinned. It compares two approaches, modifying the app package directly and injecting CSS at runtime through the Chrome DevTools Protocol (CDP). It then describes a launcher script that applies a custom theme automatically each time the app starts, and offers tips for iterating on a design.
1. Why Desktop AI Clients Can Be Re-skinned
Re-skinning desktop AI agent clients has become a popular topic recently. Many people are surprised to find that these seemingly closed desktop apps have interfaces that can be modified freely. The underlying principle is straightforward.
Most AI chat clients and agent tools, on both Windows and macOS, are built on Electron. Electron can be understood as a combination of the Chromium browser and the Node.js runtime. The front-end interface is rendered with HTML, CSS, and JavaScript, and system capabilities are accessed through Node.js. As a result, the front-end layer of these apps is essentially no different from a web page.
Because of this, most Electron-based apps still include the ability to open developer tools. On macOS, pressing Command + Option + I inside the app usually opens a debugging panel similar to browser DevTools. In this panel, you can inspect the DOM structure, review styles, and edit CSS in real time. Changes appear in the interface immediately. This is the entry point for theme customization.
Shortcuts differ between apps, and some apps disable this feature by default. In that case, first check whether the tool is built on Electron. Then look up general methods for enabling debug mode.
2. Two Core Approaches to Custom Themes
There are two main approaches, each with its own trade-offs.
Method 1: Modifying the Archived Resources in the App Package
Electron app front-end resources are usually stored inside the app package, either as an asar archive or as a static asset directory. The basic process is:
- Locate the resource files in the app package, such as
app.asaror theassetsdirectory. - Unpack the archive or edit the style and configuration files directly.
- Inject or replace the custom CSS, then repackage the app and put it back in place.
Advantages: The changes are written into the app itself, so they go deep and persist after a restart. The scope of customization is broad, covering colors, corner radii, fonts, and layout.
Disadvantages:
- When the app is updated, the package contents are overwritten, and all changes are lost. You have to redo the process.
- On macOS, modifying the app package invalidates the original code signature. The system may ask you to grant permissions again, and you may see Keychain access prompts on every launch.
- If you repackage the modified app as a standalone application, you run into the same signing and distribution issues.
Method 2: Injecting Custom CSS with DevTools and CDP
CDP, or Chrome DevTools Protocol, is the debugging protocol provided by Chromium. After you connect to the app’s renderer process through CDP, you can inject styles dynamically. For example, you can run the following in the DevTools console or through a script:
const style = document.createElement('style');style.textContent = `:root { --primary: #4f6ef2; }.sidebar { background: linear-gradient(180deg,#1e2233,#12141f); }`;document.head.appendChild(style);
Advantages: This approach does not touch the app package, so the code signature stays intact and the risk of breakage after updates is low. It is flexible and well suited to quickly testing colors and iterating on designs.
Disadvantages: The injection exists only at runtime. If the app restarts and nothing injects the CSS automatically, the theme disappears.
3. A Practical Compromise: The Script Launcher
Each approach has weaknesses. Developers in the community commonly combine them into a script launcher:
- Store the theme CSS in a separate file, which makes version control and iteration easier.
- Use a launcher script to start the target app in debug mode.
- Connect to the renderer process through CDP and inject the CSS automatically after the page finishes loading.
- Open the app through the launcher each time. The theme then applies automatically, so no manual steps are needed.
This approach balances depth (the CSS can be as complex as you want), stability (the app package is untouched and the signature is unaffected), and persistence (the CSS is injected automatically on every launch). It is currently the most recommended path for personal customization. It works on both Windows and macOS, and the same idea applies to any Electron-based client.
4. Tips for the Customization Process
A good theme rarely comes together in one pass. Work iteratively. First, define your design goals: dark or light mode, primary color, and whether to keep the original layout. Then start with individual areas, such as the sidebar, the input box, and the message bubbles. After each change, compare screenshots. Expect many rounds of fine-tuning, sometimes dozens, before a theme moves from “it works” to “it looks good.” You can also use an AI assistant to generate and refine CSS selectors, which can save a lot of time.
Finally, theme customization is a personal project. Do not alter the core logic of the application, and do not use modified apps for commercial redistribution. Once you understand how the pieces fit together, you can start building your own theme.
