I want to run gvim with a dark color theme, so that the tabs don't stand in contrast to the dark colorscheme:
There appears to be a way to do this in GTK 3.
Is there a way to do this in GTK 2 without changing the color scheme for all applications?
A hack solution is to edit ~/.gtkrc-2.0, wait until the application starts and edit the file again.
You can automate it.
Assuming Adwaita is your default theme and that you want to switch to Clearlooks-Zenburn, write a script called darkgtk2start and make it executable with chmod +x filename:
sed -i 's/gtk-theme-name="Adwaita"/gtk-theme-name="Clearlooks-Zenburn"/' ~/.gtkrc-2.0
"$@"
sleep 1
sed -i 's/gtk-theme-name="Clearlooks-Zenburn"/gtk-theme-name="Adwaita"/' ~/.gtkrc-2.0
Now you can start gvim dark by running:
./darkgtk2start gvim
If you move the script to a location in your PATH (.local/bin/ is a common one) you don't have to use ./ any more and you can replace the gvim command by adding the following line to ~/.bashrc:
alias gvim='darkgtk2start gvim'