View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide


Home   How To   Code Pool   Public Library   Theory   Events
using a HSV display



var res = 20, scrsize = 200, val, set, win, scr;
win ="SCColorChooser",Rect(400, 400, 2*scrsize+20, scrsize),false).front;
scr =,Rect(scrsize+20, 0, scrsize, scrsize));
val = SCSlider(win, Rect(scrsize, 0, 20, scrsize)).value_(1).action_({win.refresh});
m = SC2DTabletSlider(win, Rect(0, 0, scrsize, scrsize))
	.mouseDownAction_({arg view, x, y; 
		("Color.hsv("++(x)++", "++(1-y)++", "++val.value++", 1)").postln; 
		Color.hsv(min(0.999, x), min(0.999, 1-y), val.value, 1).postln; 
		scr.background_(Color.hsv(min(0.999, x), min(0.999, 1-y), val.value, 1));
win.drawHook = {{ arg i;{ arg j;
			Color.hsv(1/res*i,1/res*j, val.value, 1).set;
			Pen.fillRect(Rect((scrsize/res)*i, (scrsize/res)*j, (scrsize/res), (scrsize/res)));


// SCColorChooser by scsolar 10.2007

Link to this Page