use Tk::ColorEditor; $cref = $mw->ColorEditor(-title => $title, -cursor => @cursor); $cref->Show;
ColorEditor allows some customization: you may alter the color attribute menu by adding and/or deleting menu items and/or separators, turn the status window on or off, alter the configurator's list of color widgets, or even supply your own custom color configurator callback.
use Tk::ColorEditor; $cref = $mw->ColorEditor( -title => $title, -cursor => @cursor, ); mw - a window reference, usually the result of a MainWindow->new call. As the default root of a widget tree, $mw and all descendant widgets at object-creation-time are configured by the default color configurator procedure. (You probably want to change this though or you might end up colorizing ColorEditor!) title - Toplevel title, default = ' '. cursor - a valid Tk '-cursor' specification (default is 'top_left_arrow'). This cursor is used over all ColorEditor "hot spots".
$cref->configure(-option => value, ..., -option-n => value-n); options: -command : a callback to a `set_colors' replacement. -widgets : a reference to a list of widget references for the color configurator. -display_status : TRUE IFF display the ColorEditor status window when applying colors. -add_menu_item : 'SEP', or a color attribute menu item. -delete_menu_item : 'SEP', a color attribute menu item, or color attribute menu ordinal. For example: $cref->configure(-delete_menu_item => 3, -delete_menu_item => 'disabledforeground', -add_menu_item => 'SEP', -add_menu_item => 'New color attribute', -widgets => [$ce, $qu, $f2b2], -widgets => [$f2->Descendants], -command => [\&my_special_configurator, some, args ] );
$cref->Show;
$cref->configure( -widgets => [ @{$Filesystem_ref->cget(-widgets)}, @{$cref->cget(-widgets)}, ] );
$cref->delete_widgets($OBJTABLE{$objname}->{'-widgets'})
Many thanks to Guy Decoux (decoux@moulon.inra.fr) for doing the initial translation of tcolor.tcl to TkPerl, from which this code has been derived.