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.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap