The function is named TBC. After you load this lisp file, you can type in TBC and this will toggle the background color from Black to White and so on. See animated GIF at the bottom of this post.
(vl-load-com) (defun c:TBC (/ pref col cur tm) (setq tm (getvar "tilemode")) (setq pref (vla-get-display (vla-get-Preferences (vlax-get-acad-object) ) ) ) (if (zerop tm) (setq cur (vla-get-graphicswinlayoutbackgrndcolor pref)) (setq cur (vla-get-graphicswinmodelbackgrndcolor pref)) ) (setq col (vlax-variant-value (vlax-variant-change-type cur vlax-vblong ) ) ) (if (not (or (eq col 0) (eq col 16777215))) (setq col 0) ) (cond ((zerop tm) (vla-put-graphicswinlayoutbackgrndcolor pref (vlax-make-variant (abs (- col 16777215)) vlax-vblong) ) ) (t (vla-put-graphicswinmodelbackgrndcolor pref (vlax-make-variant (abs (- col 16777215)) vlax-vblong) ) ) ) (vlax-release-object pref) (princ) )