How to Change Background/Foreground Color to Vim

We can change the background and foreground colors in Vim editor using the colorscheme.

Let's say you have opened a file using Vim and now you want to change the color scheme, you can simply type :colorscheme followed by the name of the color scheme.


Example:

:colorscheme desert
Change Color Scheme of Vim

List of Color Schemes: Vim

Colorscheme NameBackground ColorForeground Color
desertDark GrayLight Orange
gruvboxDark BrownLight Beige
solarizedDark Blue-GreenLight Blue-Gray
molokaiDark CharcoalLight Gray
nordDark Blue-GrayLight Gray-Blue
draculaDark Purple-BlueLight Gray
onedarkDark Blue-GrayLight Gray
monokaiDark Green-GrayLight Gray
jellybeansDark PurpleLight Beige
icebergDark Blue-GrayLight Blue

Adding the colorscheme in .vimrc:

    Open the .vimrc file using the vim editor and add the following line.

    vim ~/.vimrc
    colorscheme desert

    Save and Quit.

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!