// A color picker with all-macro sliders // See Macro_Sliders_Demo.txt for a simpler sliders demo. // jerome.mutterer(at)ibmp.fr var w=10; var h=20; var ch =newArray(50,80,160); var colors =newArray("red","green","blue"); var name = "RGB Color Picker"; var active = 0; macro "Slider Tool - Cf00L03f3F7233C0c0L07f7F3633C00fL0bfbFaa33" { getCursorLoc(x,y,z,flags); if (getTitle!=name) { v=getPixel(x,y); if (active==0) setForegroundColor((v>>16)&0xff,(v>>8)&0xff,v&0xff); else setBackgroundColor((v>>16)&0xff,(v>>8)&0xff,v&0xff); ch[0]=(v>>16)&0xff; ch[1]=(v>>8)&0xff; ch[2]=v&0xff; selectWindow(name); for (i=0;i=0)&&(x<=255)&&(c=ch.length) { v=getPixel(x,y); if (x>16)&0xff,(v>>8)&0xff,v&0xff); } else { active =1; setBackgroundColor((v>>16)&0xff,(v>>8)&0xff,v&0xff); } ch[0]=(v>>16)&0xff; ch[1]=(v>>8)&0xff; ch[2]=v&0xff; for (i=0;igetWidth/2) offset = -20; setColor(0); setFont("SansSerif",9); drawString (ch[i],ch[i]+offset, i*h+15); } function updateColor() { setColor(255,255,255); drawRect(0, getHeight-30, getWidth, 30); if (active==0) { setColor(0,0,0);drawRect(0, getHeight-30, getWidth/2, 30); setColor(ch[0],ch[1],ch[2]);fillRect(1, getHeight-30+1, getWidth/2-2, 30-1); } else { setColor(0,0,0);drawRect(getWidth/2-1, getHeight-30, getWidth-getWidth/2+2, 30); setColor(ch[0],ch[1],ch[2]);fillRect(getWidth/2, getHeight-30+1, getWidth-getWidth/2, 30-1); } }