Most elegant way to detect available colors in terminal to use colorschemes in vim? Most elegant way to detect available colors in terminal to use colorschemes in vim? shell shell

Most elegant way to detect available colors in terminal to use colorschemes in vim?


Another try: some information is here, if you haven't found it already, including informative link at bottom of the linked page:

256_colors_in_vim

So far as I know Vim gets the t_Co number from termcap. So if you can get value from termcap to accurately reflect max colors supported then you're set. I think that's what the info in linked page does, at least for 256 color terms. . .