Author Topic: Dark | Light Chocolate  (Read 3870 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Dark | Light Chocolate
« 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.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Dark | Light Chocolate
« Reply #1 on: April 26, 2020, 05:45:45 PM »
I guess you could also use (- 1 (getvar 'colortheme)) to avoid wearing out your abs.  :lol:
« Last Edit: April 26, 2020, 05:49:07 PM by Lee Mac »

DEVITG

  • Bull Frog
  • Posts: 479
Re: Dark | Light Chocolate
« Reply #2 on: April 27, 2020, 06:23:30 AM »
Very nice MP, I love the way it seem.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: Dark | Light Chocolate
« Reply #3 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?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

GDF

  • Water Moccasin
  • Posts: 2081
Re: Dark | Light Chocolate
« Reply #4 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.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dark | Light Chocolate
« Reply #5 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))



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)
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: Dark | Light Chocolate
« Reply #6 on: April 27, 2020, 10:48:58 AM »
Oh, you beat me to the BNOT. :)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dark | Light Chocolate
« Reply #7 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
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lonnie

  • Newt
  • Posts: 169
Re: Dark | Light Chocolate
« Reply #8 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

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: Dark | Light Chocolate
« Reply #9 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
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dark | Light Chocolate
« Reply #10 on: April 27, 2020, 03:19:57 PM »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

wizman

  • Bull Frog
  • Posts: 290
Re: Dark | Light Chocolate
« Reply #11 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))))