Change background color via command?

Is it possible to change background color by a keyboard command? Or by a menu command? Some way without opening the Settings dialog.I'd like to be able to toggle between black and white background, but I can't find a system variable that sets background color.I need this for paperspace background color more than for modelspace background color.

Comments

  • I have two buttons on the toolbar... I am sure there are other ways but it works well for me. You can set the colour you wish:Toggle paper space background:

    (if (= (getvar "BKGCOLORPS") 7)(setvar "BKGCOLORPS" 0)(setvar "BKGCOLORPS" 7))(princ)

    and for model space background:

    (if (= (getvar "BKGCOLOR") 7)(setvar "BKGCOLOR" 0)(setvar "BKGCOLOR" 7))(princ)

    Hope that helps...Greg

  • Yes, thanks, Greg. That's exactly what I wanted. I didn't think there was a variable for background color. BKGCOLOR doesn't appear when I ask Bricscad to display a list of variables by typing: SETVAR ? *How did you find it? I've always suspected there were undocumented variables, and I'd like to find a complete list.

  • Hello Antony,the most complete overview of variables, preferences and settings is provided by the Settings dialog: key in 'Settings' to bring it up. It shows all variables, either sorted alphabetically of grouped by domain. For each setting a short description is provided, as well as information about the scope, variable type and storage location of the setting. Most interesting feature is the search field at the top, which by default has the focus when the dialog opens. You're looking for a setting to control the background, so start keying in 'b' 'a' 'c' k' 'g' ... and by now the content of the settings dialog will have scrolled and highlighted the BKGCOLOR setting...Best regards

  • Thanks, Hans. I never noticed the variable names in the Settings dialog before. That's very helpful.In case anyone else may want to use it: I've combined Greg's two routines into a single routine that toggles whichever background color is currently visible.

    (defun c:BC ()(if (equal (getvar "TILEMODE") 0) (if (equal (getvar "BKGCOLORPS") 7) (setvar "BKGCOLORPS" 0) (setvar "BKGCOLORPS" 7)) (if (equal (getvar "BKGCOLOR") 7) (setvar "BKGCOLOR" 0) (setvar "BKGCOLOR" 7)) ))
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!