• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.


Color picker

Page history last edited by PBworks 14 years, 6 months ago

>How do I change the current color picker for assigning colors to morphs?


>For an image I'm configuring I would like to have a fairly large color

>picker with just a dozen colors (12 EllipseMorphs of different colors to

>click on).


>And I would also like that the third and fourth color chooser (which are

>grayed out) do not show up.


>How do I do that? (preferably with a preference setting)


First of all, be aware that when you click on the "recolor" handle,

you can get a simple color-picker rather than the huge "property

sheet" -- this is under control of a preference,

"propertySheetFromHalo". For your application, you'll almost surely

want to set this preference to false.


But you still want to create a custom color-picker that has a small

number of oversize swatches. For this, you, or someone, will need to

write a little code.


I think Color class method #colorPaletteForDepth:extent: is probably

the first place to look, because that's where the existing color

picker is constructed.


A reasonable way to start would be to define your own

ColorPickerMorph subclass, and in it write the code that defines your

custom picker's appearance; you can try to adapt the code in

#colorPaletteForDepth:extent:, or perhaps just write your own code

from scratch. (If you only want a dozen colors, you probably also

don't want the clutter and the complexity of the "translucency" are.)


Next, perhaps a good place to thread your new picker into your user's

experience is to modify method Morph.changeColor, such that instead

of launching a ColorPickerMorph, it instead launches a



Or, alternatively, modify HaloMorph method #doRecolor:with:.


If you were to bring this topic up in a message to the Squeak

*Developers* List, I imagine that several people there would quickly

offer advice, encouragement, and probably also actual code for

creating your custom color picker.


PS: If you have "propertySheetFromHalo" set to false, you can still

get the big property sheet, on those occasions when you want it, by

holding down the shift key as you click on the "recolor" handle.


And conversely, if propertySheetFromHalo is true, you can still get

the simple picker by holding down the shift key as you click on the

"recolor" handle.

Comments (0)

You don't have permission to comment on this page.