Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Color Picker
name
code content
// Color Picker GUIs ( // OSX Only var res = 20, scrsize = 200, val, set, win, scr; win = Window.new("SCColorChooser",Rect(400, 400, 2*scrsize+20, scrsize),false).front; win.view.background_(Color.white); scr = CompositeView.new(win,Rect(scrsize+20, 0, scrsize, scrsize)); scr.background_(Color.white); val = Slider(win, Rect(scrsize, 0, 20, scrsize)).value_(1).action_({win.refresh}); m = TabletSlider2D(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 = { res.do({ arg i; res.do({ 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))); }) }) }; win.front; ) // SCColorChooser by scsolar 10.2007 ColorPicker { // Class by Miguel Negrão *new { var w,r,g,b,update,color; w = Window.new("Color Picker",Rect(100,100,230,68),false); r = EZSlider(w, Rect(2,0,150,20),"R",labelWidth:20) .action_({ |v| update.(); }); g = EZSlider(w, Rect(2,22,150,20),"G",labelWidth:20) .action_({ |v| update.(); }); b = EZSlider(w, Rect(2,44,150,20),"B",labelWidth:20) .action_({ |v| update.(); }); [r,g,b].do({|item| item.sliderView.canFocus_(false) }); color = UserView(w,Rect(160,0,64,64)) .background_(Color.black) .enabled_(true) .mouseDownAction_({ color.background.postln;}) .beginDragAction_({color.background}) .canFocus_(false); update = { color.background_(Color(r.value,g.value,b.value)) }; w.front; } }
code description
Migration from the old SourceForge wiki.
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change