{
   "code" : "// Color Picker GUIs\r\n\r\n( // OSX Only\r\n\r\nvar res = 20, scrsize = 200, val, set, win, scr;\r\nwin = Window.new(\"SCColorChooser\",Rect(400, 400, 2*scrsize+20, scrsize),false).front;\r\nwin.view.background_(Color.white);\r\nscr = CompositeView.new(win,Rect(scrsize+20, 0, scrsize, scrsize));\r\nscr.background_(Color.white);\r\nval = Slider(win, Rect(scrsize, 0, 20, scrsize)).value_(1).action_({win.refresh});\r\nm = TabletSlider2D(win, Rect(0, 0, scrsize, scrsize))\r\n\t.mouseDownAction_({arg view, x, y; \r\n\t\t(\"Color.hsv(\"++(x)++\", \"++(1-y)++\", \"++val.value++\", 1)\").postln; \r\n\t\tColor.hsv(min(0.999, x), min(0.999, 1-y), val.value, 1).postln; \r\n\t\tscr.background_(Color.hsv(min(0.999, x), min(0.999, 1-y), val.value, 1));\r\n\t});\r\nwin.drawHook = {\r\n\tres.do({ arg i;\r\n\t\tres.do({ arg j;\r\n\t\t\tColor.hsv(1/res*i,1/res*j, val.value, 1).set;\r\n\t\t\tPen.fillRect(Rect((scrsize/res)*i, (scrsize/res)*j, (scrsize/res), (scrsize/res)));\r\n\t\t})\r\n\t})\r\n};\r\nwin.front;\r\n\r\n)\r\n\r\n// SCColorChooser by scsolar 10.2007\r\n\r\n\r\n\r\nColorPicker { // Class by Miguel Negrão\r\n\r\n\t*new {\r\n\t\tvar w,r,g,b,update,color;\r\n\t\tw = Window.new(\"Color Picker\",Rect(100,100,230,68),false);\r\n\t\tr = EZSlider(w, Rect(2,0,150,20),\"R\",labelWidth:20)\r\n\t\t.action_({ |v| update.(); });\r\n\t\tg = EZSlider(w, Rect(2,22,150,20),\"G\",labelWidth:20)\r\n\t\t.action_({ |v| update.(); });\r\n\r\n\t\tb = EZSlider(w, Rect(2,44,150,20),\"B\",labelWidth:20)\r\n\t\t.action_({ |v| update.(); });\r\n\t\t\r\n\t\t[r,g,b].do({|item| item.sliderView.canFocus_(false) });\r\n\r\n\t\tcolor = UserView(w,Rect(160,0,64,64))\r\n\t\t.background_(Color.black)\r\n\t\t.enabled_(true)\r\n\t\t.mouseDownAction_({ color.background.postln;})\r\n\t\t.beginDragAction_({color.background})\r\n\t\t.canFocus_(false);\r\n\r\n\t\t\r\n\t\tupdate = { color.background_(Color(r.value,g.value,b.value)) }; \r\n\r\n\t\tw.front;\r\n\r\n\t}\r\n}",
   "is_private" : null,
   "id" : "1-56W",
   "labels" : [
      "gui",
      "color picker"
   ],
   "ancestor_list" : [],
   "description" : "Migration from the old SourceForge wiki.",
   "author" : "codepool",
   "name" : "Color Picker"
}
