background screen color

Is it possible to get background colors other than those shown in Settings?
I would like autocad color 111.

Thanks

Comments

  • Charles Alan Butler
    edited January 2019

    This may help:

    ;|sub-routines to change Model Space & text window background & text
    color(s). Autocad colors 1 - 7 are supported, any other
    number, or nil, will go to black. Other colors can be added,
    just make sure to convert from Autocad color to
    OLE_COLOR number first. May need to adjust
    text color as well.
    by Jeff Mishler, April 2004
    usage: (set_txt_bkgrnd 1) will set background to Red
    |;
    (defun set_txt_bkgrnd (color)
    (cond ((eq color 1)(setq color 255))
    ((eq color 2)(setq color 65535))
    ((eq color 3)(setq color 65280))
    ((eq color 4)(setq color 16776960))
    ((eq color 5)(setq color 16711680))
    ((eq color 6)(setq color 16711935))
    ((eq color 7)(setq color 16777215))
    (t(setq color 1))
    )
    (vla-put-TextWinBackgrndColor
    (vla-get-display
    (vla-get-Preferences
    (vlax-get-acad-object)
    )
    )
    color
    )
    )

    (defun set_txt_foregrnd (color)
    (cond ((eq color 1)(setq color 255))
    ((eq color 2)(setq color 65535))
    ((eq color 3)(setq color 65280))
    ((eq color 4)(setq color 16776960))
    ((eq color 5)(setq color 16711680))
    ((eq color 6)(setq color 16711935))
    ((eq color 7)(setq color 16777215))
    (t(setq color 1))
    )
    (vla-put-TextWinTextColor
    (vla-get-display
    (vla-get-Preferences
    (vlax-get-acad-object)
    )
    )
    color
    )
    )

    (defun set_MS_bkgrnd (color)
    (cond ((eq color 1)(setq color 255))
    ((eq color 2)(setq color 65535))
    ((eq color 3)(setq color 65280))
    ((eq color 4)(setq color 16776960))
    ((eq color 5)(setq color 16711680))
    ((eq color 6)(setq color 16711935))
    ((eq color 7)(setq color 16777215))
    (t(setq color 1))
    )
    (vla-put-GraphicsWinModelBackgrndColor
    (vla-get-display
    (vla-get-Preferences
    (vlax-get-acad-object)
    )
    )
    color
    )
    )

  • @tomcarver said:
    Is it possible to get background colors other than those shown in Settings?
    I would like autocad color 111.

    Thanks

    another option

  • To Kerry Brown,
    Thanks for taking the time to answer. I was not specific enough. I meant the color form the true color tab, RGB color 111,111,111.

    Thanks,
    Tom

  • Charles Alan Butler
    edited January 2019

    So is this the color you are looking for?
    (vla-put-GraphicsWinModelBackgrndColor (vla-get-display (vla-get-Preferences (vlax-get-acad-object))) 7303023)

    https://www.shodor.org/stella2java/rgbint.html

  • Roy Klein Gebbinck
    edited January 2019

    @Charles Alan Butler:
    In my test the code in your last contribution does not work as intended. The color does change, but not to the specified true color.

  • So it appears that BricsCAD will not be forced into True Color background only Index colors.

  • Peter_DV
    edited January 2019

    An easier solution, if it's about changing background colours to another autocad color,

    make a new button on a toolbar and in the command line box put in
    $M=$(if,$(and,$(getvar,BKGCOLOR),256),BKGCOLOR;251,BKGCOLOR;256)

    The above will toggle you between two colours, in this case 256 and 251
    change either of those to 111 or whatever colour that suits your taste/needs.

    Does Acad let you use anything else then the regular 256 colours these days ?

  • @Charles Alan Butler said:
    So it appears that BricsCAD will not be forced into True Color background only Index colors.

    Yes, looks like it's been like that for a while. I wrote this LISP to toggle between Black and White quite a while ago and had to take this into account.
    ;------------------------------------------------------------------------------
    ; CAD Concepts Limited
    ;
    ; TOGGLE BACKGROUND COLOR
    ;
    ; Copyright (C) 2012 CAD Concepts Limited.
    ; TOGGLE BACKGROUND COLOR by CAD Concepts Ltd is licensed under
    ; a Creative Commons Attribution-ShareAlike 3.0 Unported License.
    ; http://creativecommons.org/licenses/by-sa/3.0/nz/deed.en
    ; For options available to you under this license.

    ; This software is provided "as is". No liability is taken of
    ; FITNESS FOR ANY PARTICULAR PURPOSE.
    ;------------------------------------------------------------------------------
    ; File          : ToggleBackgroundBolour.lsp
    ; Author        : Jason Bourhill
    ; Email         : jason@cadconcepts.co.nz
    ; Web           : http://www.cadconcepts.co.nz
    ; Date          : 01/June/2012
    ; CAD Ver(s)    : Tested on Bricscad V11, V12, AutoCAD 2012
    ; Purpose       : Toggle the background colour between Black and White.
    ;
    ; Usage         : To load type (load "ToggleBackgroundColour.LSP") from the command line or drag
    ;                 and drop the file onto your drawing using explorer.
    ;
    ;                 To run the routine type TBC or TOGGLEBACKGROUNDBOLOUR at the command line.
    ;                 Toggles the Background colour between Black and White
    ;
    ; Requires      : Nothing else
    ;------------------------------------------------------------------------------
    ; Rev no   : A
    ; Reason   : First release
    ; Rev Date : 08/April/2011
    ; Rev by   : Jason Bourhill
    ; Email    : jason@cadconcepts.co.nz
    ;
    ; Description:
    ; First release.
    ;------------------------------------------------------------------------------
    ; Rev no   : B
    ; Reason   : Revised to work with AutoCAD
    ; Rev Date : 01/June/2012
    ; Rev by   : Jason Bourhill
    ; Email    : jason@cadconcepts.co.nz
    ;
    ; Description:
    ; Changed routine so that it will work in either AutoCAD or Bricscad.
    ; Required changing to Visual Lisp. Not tested in Linux.
    ;------------------------------------------------------------------------------
    
    ; TOGGLE BACKGROUND COLOR
    ; Purpose : Toggle the background colour between Black and White.
    ;------------------------------------------------------------------------------
    (defun C:TOGGLEBACKGROUNDCOLOUR ( / AcadBlack BcadBlack AcadWhite BcadWhite colourblack colourwhite oAcad oPrefs oDisplay vColour iColour)
        (vl-load-com) ; make sure Visual Lisp Extensions are available
        ; set colour options
        (setq AcadBlack 0 BcadBlack 256) ; set Black colour for AutoCAD/Bricscad
        (setq AcadWhite 16777215 BcadWhite 7) ; Set White colour fo AutoCAD/Bricscad
        (cond
            ((eq (getvar "PROGRAM") "acad") ; If the application is AutoCAD
                (setq colourblack AcadBlack colourwhite AcadWhite) ; THEN set our colour options to suit
            )
            ((eq (getvar "PROGRAM") "BRICSCAD") ; If the application is BricsCAD
                (setq colourblack BcadBlack colourwhite BcadWhite) ; THEN set our colour options to suit
            )
            ( T (setq colourblack BcadBlack colourwhite BcadWhite)); Otherwise use Bricscad colour options
        ); end cond 
        (setq oAcad (vlax-get-acad-object)); retrieve the acad object
        (setq oPrefs (vla-get-Preferences oAcad)); retrieve the preferences object
        (setq oDisplay (vla-get-display oPrefs)) ; retrieve the display object
    
        (if (= 0 (getvar "TILEMODE")) ; check if your in modelspace or not
            (setq vColour (vla-get-graphicswinlayoutbackgrndcolor oDisplay)) ; get paperspace color
            (setq vColour (vla-get-graphicswinmodelbackgrndcolor oDisplay)) ; get modelspace color
        )
        (setq iColour (vlax-variant-value (vlax-variant-change-type vColour vlax-vblong))) ; change the variant value to a long integer
        (if (/= iColour colourblack) ; if the background is not black   
            (setq iColour colourblack) ; then change it to black
            (setq iColour colourwhite) ; else change it to white
        )
        (setq vColour (vlax-make-variant iColour vlax-vblong)); convert our colour back to a variant vlaue
        (if (= 0 (getvar "TILEMODE")) ; check if your in modelspace or not
            (vla-put-graphicswinlayoutbackgrndcolor oDisplay vColour) ; set paperspace color
            (vla-put-graphicswinmodelbackgrndcolor oDisplay vColour) ; set modelsapce color
        ); end if
        (foreach objname (list oDisplay oPrefs oAcad) (vlax-release-object objname)); release each of our objects
        (gc) ; garbage collect
    (prin1) ; make a quiet exit 
    ); end DEFUN C:TOGGLEBACKGROUNDCOLOUR
    

    You could use VLE-rgb2aci to convert from rgb to the closest index colour

    : (vle-rgb2aci 111 111 111)
    8
    : (vle-aci2rgb 8)
    (128 128 128)
    

    Regards,
    Jason Bourhill
    CAD Concepts


    Come to the Australasia BricsCAD Conference


Sign In or Register to comment.

Howdy, Stranger!

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