To run this script
Select Scripts > Layout > Toggle_Background_Color from the Menus.
Or, in versions that support the script, you can run the utility directly from this page using this button.
This script changes the layout background color to black if it is white or to white if it is black. Below is an example of two layout windows before and after the code is run.