AWT TrayIcon API allows to set an animated image to tray icons. Every frame of animation is drawn over the previous one, this is implemented by clearing the whole rect of icon and drawing the new frame after this, otherwise we get a wrong image as described in 6267936. The color for clearing is obtained with getBackground(), so a grey rect appears. For details see the code for XTrayIconPeer.IconCanvas.paint() at XTrayIconPeer.java:517:
gr.fillRect(0, 0, curW, curH); <-- here the grey rect appears
gr.drawImage(image, 0, 0, curW, curH, observer);
I'm not sure if we can query KDE or GNOME about underlying panel color. Furthermore, that panel may have an arbitrary background image, so the best way to fix this bug is to query KDE or GNOME to repaint the panel below the tray icon, but I'm not sure if such API is available to AWT.