Code Red > AutoLISP (Vanilla / Visual)

Change crosshait color with lisp

<< < (3/3)

Lee Mac:

--- Quote from: PM on June 15, 2021, 06:53:28 PM ---Where i can find the number for the colors

for example 49151 --> 40 and 16777215->white  ???? Is any list of colors and numbers ??
--- End quote ---

As noted in my post:

--- Quote from: Lee Mac on June 13, 2021, 05:36:33 PM ---The colours are expressed as OLE colours, for which you can calculate the appropriate values using the OLE conversion functions as part of my Colour Conversion functions.
--- End quote ---

JohnK:

--- Quote from: Lee Mac on June 15, 2021, 07:02:47 PM ---
--- Quote from: John Kaul (Se7en) on June 15, 2021, 11:29:33 AM ---There isn't a need to hardcode the original value; just check and change.
--- Code - Auto/Visual Lisp: ---;; toggle the current cursor color from 40 to white (and vise versa)
--- End quote ---

But here white is arbitrarily hardcoded as a default.

--- End quote ---

No it is not (you must not have tried it). I'm just using either a LOGIOR (7) or XOR (6) to set or clear a bit(s).

I just saw this as an excellent opportunity to show how BOOLE can be used for different boolean operators all in one call--as I too was shown a long time ago.

Lee Mac:

--- Quote from: John Kaul (Se7en) on June 15, 2021, 09:40:14 PM ---
--- Quote from: Lee Mac on June 15, 2021, 07:02:47 PM ---
--- Quote from: John Kaul (Se7en) on June 15, 2021, 11:29:33 AM ---There isn't a need to hardcode the original value; just check and change.
--- Code - Auto/Visual Lisp: ---;; toggle the current cursor color from 40 to white (and vise versa)
--- End quote ---

But here white is arbitrarily hardcoded as a default.

--- End quote ---

No it is not (you must not have tried it). I'm just using either a LOGIOR (7) or XOR (6) to set or clear a bit(s).
--- End quote ---

It is; and no, I don't need to try it as I can see & understand the operations being performed.

Firstly, the cond statement to change the boole operator seems redundant, as 16777215 (224-1) represents OLE 255,255,255 which is the largest possible value, and so (<= currentvalue 16777215) will always be true, which means the expression may become a simple XOR of the current value and 16728064 = 16777215 XOR 49151 (colour 40). Hence, for colour 40 you have essentially arbitrarily hardcoded white as the alternative colour (as I noted earlier); for all other colours, the default becomes the XOR of the current colour with 16728064.

Navigation

[0] Message Index

[*] Previous page

Go to full version