skip to main content

Jixun's Blog 填坑还是开坑,这是个好问题。

Restyle Charles with Flat Look-and-Feel

What is Charles #

A man-in-the-middle proxy that can be used to intercept network traffics between 2 devices.

By default it uses whatever the Java Swing default is, so… here we are:

The default Charles interface

Install FlatLAF for Arch Linux #

Firstly, prepare our workspace directory and download FlatLAF 2.3:

sudo mkdir -p /opt/charles_flatlaf
sudo wget -O /opt/charles_flatlaf/flatlaf-2.3.jar \

Write our loader to the workspace:

sudo tee /opt/charles_flatlaf/launch_charles <<'EOF'

# Setup some variables...

exec "$JAVA" $OPTS \
  -Xmx1024M \
  -Dawt.useSystemAAFontSettings=on \
  -Dswing.aatext=true \
  -Dswing.defaultlaf="$THEME" \
  -Dswing.crossplatformlaf="$THEME" \
  -Dcharles.config="${XDG_CONFIG_HOME:-~/.config/charles}/.charles.config" \
  -Djava.library.path="$CHARLES_LIB" \
  -classpath "/opt/charles_flatlaf/flatlaf-2.3.jar:${CHARLES_LIB}/charles.jar" \
  com.xk72.charles.gui.MainWithClassLoader \
  "[email protected]"


Finally, mark it as executable, and have it in the $PATH with higher priority:

sudo chmod a+x /opt/charles_flatlaf/launch_charles
sudo ln -s /opt/charles_flatlaf/launch_charles /usr/local/bin/charles

If we don’t want it anymore, just remove them:

sudo rm -rf "/opt/charles_flatlaf/"
sudo rm "/usr/local/bin/charles"

※ Flags were inspired from discussions in AUR 1.

※ Does not work in Ubuntu. Please wait for update or adjust the script accordingly…

Charles 打上扁平皮肤后在 EndeavourOS 下的截图

Install FlatLAF for Windows #

Windows is a bit tricky - it uses an executable file to load the Java application, and ignores swing flags.

We’ll have to get our hands dirty in this case…

  1. Install a full copy of JDK 11, for instance Adoptium JDK 11. Embedded JDK is missing some modules.
  2. Remember the path you’ve installed to. The default should be:
    C:\Program Files\Eclipse Adoptium\jdk-\
  3. Download the latest release of CharlesFlatLAF or compile your own, place it under <Charles>/lib;
  4. Update Charles.ini:
    • Make a backup.
    • Insert the following line after classpath.1:
    • Replace the line with main.class to:
    • Insert the following line after vmarg.4:
    • Replace the line with vm.location to:
      vm.location=<JDK path>\bin\server\jvm.dll

… and your final Charles.ini should look some-what like this:
vm.location=C:\Program Files\Eclipse Adoptium\jdk-\bin\server\jvm.dll

java.not.found=The bundled Java installation was not found. Please uninstall and reinstall Charles.
java.failed=The bundled Java installation is broken. Please uninstall and reinstall Charles.

Start Charles via Desktop shortcut, just as expected:

Windows 下打上平坦皮肤补丁后的截图

Afterthoughts #

You might have noticed that it looks exactly like zaproxy.

Indeed, I was researching for alternatives and I quite liked the zaproxy theming; however I’d like to make the layout closer to Charles…

I thought, they are both made of Java. There must’ve been a way to apply the same theme. So I went and looked around, got this Java Agent to monkey patch things.

Experimenting further under Linux, it works without the agent - what a surprise. Tried to back-port the steps to Windows, no joy. welp.

  1. See this AUR comment regarding Font AA & GTK theming for Charles. ↩︎

Creative Commons Licence This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.