Is there any css code for browsers to print out background colors? No, there is no such css code, background images and colors are ignored for browsers. So don’t rely on background colors for printing.
To let browsers print background colors and images, you need to configure your browsers option.