[Q] Larger color picker with fewer colors
Scott Wallace
scott at squeakland.org
Wed Mar 13 01:13:41 PST 2002
Hi again, Hannes.
At 8:32 AM +0100 3/13/02, Hannes Hirzel wrote:
>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
HannesColorPickerMorph.
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.
-- Scott
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.
More information about the Squeakland
mailing list