TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MP on April 26, 2020, 12:47:04 PM

Title: Dark | Light Chocolate
Post by: MP on April 26, 2020, 12:47:04 PM
In a recent LinkedIn post Sam Lucida discussed the creation of light and dark profiles to make it easy for him to switch between his working (dark mode) and documenting (light mode) environments. It's a great idea but I also thought it should be easy to toggle via a system variable, and it is:

(setvar 'colortheme (abs (1- (getvar 'colortheme))))

If you prefer a command simply:

Code: [Select]
(defun c:mode ( )
    (princ
        (strcat "\n"
            (nth (setvar 'colortheme (abs (1- (getvar 'colortheme)))) '("Dark" "Light"))
            " mode active."
        )
    )
    (princ)
)

Cheers.
Title: Re: Dark | Light Chocolate
Post by: Lee Mac on April 26, 2020, 05:45:45 PM
I guess you could also use (- 1 (getvar 'colortheme)) to avoid wearing out your abs.  :lol:
Title: Re: Dark | Light Chocolate
Post by: DEVITG on April 27, 2020, 06:23:30 AM
Very nice MP, I love the way it seem.
Title: Re: Dark | Light Chocolate
Post by: JohnK on April 27, 2020, 07:56:09 AM
Can I play?
You could also use (boole 6 (getvar 'colortheme) 1) to avoid wearing out your...math?
Title: Re: Dark | Light Chocolate
Post by: GDF on April 27, 2020, 08:34:41 AM
Nice

I would have called it Mood in lieu of Mode

In a recent LinkedIn post Sam Lucida discussed the creation of light and dark profiles to make it easy for him to switch between his working (dark mode) and documenting (light mode) environments. It's a great idea but I also thought it should be easy to toggle via a system variable, and it is:

(setvar 'colortheme (abs (1- (getvar 'colortheme))))

If you prefer a command simply:

Code: [Select]
(defun c:mode ( )
    (princ
        (strcat "\n"
            (nth (setvar 'colortheme (abs (1- (getvar 'colortheme)))) '("Dark" "Light"))
            " mode active."
        )
    )
    (princ)
)

Cheers.
Title: Re: Dark | Light Chocolate
Post by: MP on April 27, 2020, 10:01:45 AM
I would have called it Mood in lieu of Mode

(boole 6 (getvar 'colortheme) 1)

Very nice MP, I love the way it seem.

(- 1 (getvar 'colortheme))

(http://saneteachers.files.wordpress.com/2015/12/1508162_471028019730233_202295764181390168_n.png)

And ...

Code: [Select]
(defun c:Mood ( )
    ;;  M.Puckett, 2020 (inspired by Sam Lucido).
    (princ
        (strcat "\n"
            (nth
                (setvar 'colortheme (~ (- (getvar 'colortheme) 2)))
               '("Dark" "Light")
            )
            " mode active."
        )
    )
    (princ)
)
Title: Re: Dark | Light Chocolate
Post by: JohnK on April 27, 2020, 10:48:58 AM
Oh, you beat me to the BNOT. :)
Title: Re: Dark | Light Chocolate
Post by: MP on April 27, 2020, 11:00:25 AM
Oh, you beat me to the BNOT. :)

as well as:

(rem 3 (+ 2 (getvar 'colortheme)))

(logand 1 (1+ (getvar 'colortheme)))


 :-P
Title: Re: Dark | Light Chocolate
Post by: Lonnie on April 27, 2020, 11:14:52 AM
Along those lines.
When asked to customize the colors for the company.

Quote

(setq acadobject (vlax-get-acad-object))
(setq acadpref (vlax-get-property acadobject 'preferences))
(setq acaddisp (vlax-get-property acadpref 'display))
(vlax-put-property acaddisp 'GraphicsWinmodelBackgrndColor 65986) ;;Model space background
(vlax-put-property acaddisp 'GraphicsWinLayoutBackgrndColor  63434) ;;command area
(vlax-put-property acaddisp 'ModelCrosshairColor 865785);; crosshairs
(vlax-put-property acaddisp 'TextWinBackgrndColor 3687) ;;command area
Title: Re: Dark | Light Chocolate
Post by: tombu on April 27, 2020, 11:16:48 AM
Add CUI macro

Set Display Name to:
Code: [Select]
$(if,$(=,0,$(getvar,colortheme)),!.)Dark ModeSet Macro:
Code: [Select]
^P(ai_onoff "colortheme") ^P
Title: Re: Dark | Light Chocolate
Post by: MP on April 27, 2020, 03:19:57 PM
Add CUI macro ...

Along those lines ...

{like}
Title: Re: Dark | Light Chocolate
Post by: wizman on May 24, 2020, 06:10:57 AM
Gents, thanks for your solutions. Just adding to the collection,


(setvar 'colortheme (1+ (- (getvar 'colortheme))))

(setvar 'colortheme (lsh 1 (- (getvar 'colortheme))))

(setvar 'colortheme (nth (getvar 'colortheme) '(1 0)))

(setvar 'colortheme (fix (distance '(1 0 0) (list  (getvar 'colortheme) 0 0))))