How to Replace One Icon in an Icon Theme

The situation

I want to keep on using my current icon theme, and I want to keep on getting updates for it. There’s only one icon I need to change, specifically the icon for the systray applet that indicates that caps lock is on (my keyboard does not have an indicator).

It needs to be red, not the default color. It needs to stand out.

The icon theme I want to continue using is Breeze-Dark.

The idea

Freedesktop icon themes can inherit other themes. It should be possible to create a new theme, say breeze-dark-red-caps, that includes only the red icons I want to create, and inherits breeze-dark.

Creating the icon theme

Finding the icon in question is a little tricky; after a few tries I used
find /usr/share/icons/breeze-dark -iname '*caps-on*' which returns just a few icons in the status section.

Now do

mkdir -p ~/.local/share/icons/breeze-dark-red-caps/status/{16,32,22,24}
cd ~/.local/share/icons/breeze-dark-red-caps
for d in status/*; do cp /usr/share/icons/breeze-dark/$d/input-caps-on* $d/; done
cp /usr/share/icons/breeze-dark/index.theme .

Keep that terminal open.

Since they’re all SVG, I can edit the icons with a text editor and replace fill:currentColor with fill:red in each.

$EDITOR $(find -iname '*svg')

TODO: figure out what the current theme’s red or critical or error color is called and use that instead.

Recreate the symbolic links pointing to the 16 and 22 folders:

cd status
for i in 16 22; do
  for j in 2x 3x; do
    ln -s $i $i@$j
  done
done

Lastly, edit index.theme with the crucial Inherit=breeze-dark line. I also edited the name, removed all mentions of non-existent folders etc.

The end result looks like this.

Apply

Plasma systray

This should show up in your Settings GUI now. Choose “Breeze Dark w red caps lock”, Apply. That’s it. If you don’t use a full-blown DE you might have to edit some files, then log out/in.

Screnshot or it didn’t happen: