I didn't put color xxx in my .vimrc. So I see this when I first open my .vimrc.
Then I type :color darcula. And it changes to this.
:color gives me darcula here (naturally).

Then I type :set background=dark. And it changes to this.
:color gives me default here (amazingly).

So my question is, what exactly does :set background=dark do?
I tried :h background and didn't find anything helpful. I understand that this command doesn't actually change the background, only vim will change colors accordingly. But I still want to ask this question. Because I'm really happy with the color after :color darcula and :set background=dark so I wonder how to write my own color scheme without having to put set background=dark in my .vimrc.
I took advice from @statox and put set background=dark at the last line of my darcula.vim. Then color darcula gives me the third screenshot. However when I put it at the first line, color darcula gives me the second screenshot. Also set bg=dark changes it to the third screenshot.
I assumed by putting it at the first line, I'm telling vim that this colorscheme is designed for a dark background. By putting it at the last line, on the contrast, I let vim assume that this colorscheme is designed for a light background and then make vim change some of it by itself (when it processes the last line).
If what I assume happened is true, my question is still unanswered. What exactly did vim change, when I use set bg=dark AFTER it has loaded a light colorscheme?
My entire vim configuration is available at https://github.com/MichaelMa2014/.vim


:set bg=lightand:set bg=darkare not opposite, but what exactly they are is not explained. Also that post is why I want to avoid:set background=darkin my.vimrc. – Michael Ma Apr 17 '17 at 08:57