If you want to accomplish this programmatically you will need to check the list of available colorschemes.
To do this in :Ex
mode is fairly trivial (type :colorscheme
and then tab complete through a list of available colors). While this is a great way to check available colorschemes in general it will not solve your specific problem..
In order to verify that a colorscheme like solarized (not installed by default) is installed you will need to check the file is installed in the ~/.vim/colors/yourscheme.vim
To do this you will need to add the following conditional check to your vimrc
(may vary depending on your install):
if !empty(glob("~/.vim/colors/solarized.vim"))
colorscheme solarized
endif
glob
will expand the directory and return a string with the full pathname if the file is present. When no file is present it will return an empty string. Hopefully this approach is enough to take care of those pesky machines that don't have solarized installed!
Edit
If you prefer to use filereadable
(will simply return true/false) you will need to use expand
in order to get the global directory.