Lively Kernel canvas
//
DraftColorChooser40
10002.419595392145163Wikicontroltrue
false173.476500000000020.1255
falsefalse
nullfalsetruenull
grayfalsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
Color.addMethods({grayValue:function(){return(this.r+this.g+this.b)/3}})Widget.subclass("ColorChooserWidget",{initialize:function($super,target){$super();this.target=target},buildView:function(extent){extent=extent||pt(140,140)pane=newBoxMorph(pt(0,0).extent(extent))pane.setFill(Color.gray)pane.ownerWidget=this;slider=newSliderMorph(newRectangle(10,10,30,100));slider.valueScale=255;varoldFill=this.target.getFill();connect(slider,'value',slider.slider,'setFill',{converter:function(value){returnColor.rgb(value,value,value)}});connect(slider,'value',this.target,'setFill',{converter:function(value){returnColor.rgb(value,value,value)}});if(oldFillinstanceofColor){slider.setValue(oldFill.grayValue()*255)}pane.addMorph(slider)pane.openInWorld()returnpane}})createLayer("ColorChooserInWorldMenuLayer")layerClass(ColorChooserInWorldMenuLayer,Morph,{subMenuPropertiesItems:function($super,evt){varitems=$super(evt);items.push(["colorchooser(gray)",function(){varcolorChooser=newColorChooserWidget(this);varwindow=colorChooser.buildView()this.world().addFramedMorph(pane,"gray",this.world().positionForNewMorph(pane))}])returnitems;},})enableLayer(ColorChooserInWorldMenuLayer)8truetruefalsetruetrue
false00.11truefalsetruetrue
nullfalsetruenull
falsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
null76