Change background color of GNOME main panel when changing layouts

Two keyboard layouts are installed: English and Russian. Is it possible to somehow make the main GNOME panel change background color when switching to the Russian layout, for example, from black (default) to dark blue?

Reason: when you often have to switch between layouts, it’s terribly inconvenient to look up right, what kind of layout is on (ru/en)

Any suggestions please?

# shell extensions
sudo dnf -y install gnome-extensions-app gnome-shell-extension-user-theme
gnome-extensions enable

# input sources
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ru')]"

# shell themes
mkdir -p ~/.local/share/themes/custom-us/gnome-shell
tee ~/.local/share/themes/custom-us/gnome-shell/gnome-shell.css << EOF > /dev/null
#panel { background-color: rgba(0,0,0,1); }
#panel:overview { background-color: rgba(0,0,0,.5); }
mkdir -p ~/.local/share/themes/custom-ru/gnome-shell
tee ~/.local/share/themes/custom-ru/gnome-shell/gnome-shell.css << EOF > /dev/null
#panel { background-color: rgba(1,29,84,1); }
#panel:overview { background-color: rgba(1,29,84,.5); }

# bash script
mkdir -p ~/.local/bin
tee ~/.local/bin/ << "EOF" > /dev/null
gsettings monitor org.gnome.desktop.input-sources mru-sources \
| sed -r -e "s/^\S*\s\S*\s'(\S*)'.*$/\
gsettings set name custom-\1/e"
chmod +x ~/.local/bin/

# systemd unit
mkdir -p ~/.config/systemd/user
tee ~/.config/systemd/user/gnome-panel-color.service << EOF > /dev/null
Description=Switch GNOME panel color based on input source
systemctl --user daemon-reload 
systemctl --user enable gnome-panel-color.service
systemctl --user restart gnome-panel-color.service