"lightening" a color

Dr. Hawkins dochawk at gmail.com
Fri Jan 27 20:29:45 EST 2017


[hopefully pulling the colors brought this down to the size limit]
Bringing up an old topic . . .

I got interrupted after asking, but here's a cute way to do it.

Hopefully, someone can help with a couple of the deficiencies of this
script:
1) backgroundPixel no longer works.  Older examples to convert a color to a
triplet used it (set the backgroundPixel to a color, then set it to its own
color producing the triplet).
2) I see no way to set the mouse position other than with screenMouseLoc
3) selectedLoc when a line win a field is selected seems to do
nothing--putting it doesn't even change the output in the message box!
4) can I scroll a field to a selection?  if so, the scrolling fields in
this might even be useful!
5) because I'm monkeying around with the mouse position, I can hardly slide
at all.
6) if I could change the color of the slider on the scrollbar, this would
work much better, but I can't see a way to do that

To try, make a new card, add a slider, and put this into it's script:

on scrollbarDrag sVal

--REH, 170124

local oMloc, oClr, nClr,clrScl, oVl, linLoc

lock screen

lock messages

if not  there is a field 1 then

create field 1

set the rect of it to 10, 40, 226, 400

exit scrollBarDrag

end if

set the vScrollBar of field 1 to true

set the left of me to the left of field 1

set the top of me to the bottom of field 1 + 18

set the textheight of field 1 to 18

if not there is a field 2 then

clone field 1

exit scrollBarDrag

end if

put empty into field 2

set the top of field 2 to the top of field 1

set the left of field 2 to the right of field 1 + 18

set the textheight of field 2 to the textHeight of field 1

set the vScrollbar of field 2 to true

set the opaque of field 1 to true

set the opaque of field 2 to true

set the pageInc of me to .05

put the screenMouseLoc into oMloc

repeat with i = 1 to the number of lines in field 1

switch

case line i of field 1 is a color

case item 3 of line i of field 1 is a number

put line i of field 1 into oClr

set the backgroundColor of line i of field 1 to oClr

break

default

set the backgroundColor of line i of field 1 to empty

next repeat

break

end switch



More information about the use-livecode mailing list