ColorEditor(3pm)
β¨ NAME β¨
Tk::ColorEditor β a general purpose Tk widget Color Editor π¨π
π SYNOPSIS π
ok bestie, here's the whole vibe in four lines:
use Tk::ColorEditor;
$cref = $mw->ColorEditor(-title => $title, -cursor => @cursor);
$cref->Show;
π DESCRIPTION π
ColorEditor is built as an object with a bunch of methods, and we're gonna walk through every single one below. The move is: first you create your ColorEditor object during program initialization (one is literally enough, you don't need a whole collection, that would be giving hoarder energy), then you configure it by handing it a list of Tk widgets to colorize. When you're actually ready to use the editor, you hit it with the Show() method. π«Ά
ColorEditor lets you customize a few things, no cap: you can change up 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. Main character customization energy. π
- Call the constructor to create the editor object, which in turn returns a blessed reference to the new object β so basically it makes itself and hands you a lil reference, iconic:
use Tk::ColorEditor;
$cref = $mw->ColorEditor(
-title => $title,
-cursor => @cursor,
);
mwβ a window reference, usually the result of aMainWindow->newcall. As the default root of a widget tree,$mwand 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 itself! π yes, for real, that's a genuine hazard.)titleβ the Toplevel title, default is' '.cursorβ a valid Tk'-cursor'specification (the default is'top_left_arrow'). This cursor is the one used over all ColorEditor "hot spots". β¨
- Invoke the
configure()method to change editor characteristics β glow-up time:
$cref->configure(-option => value, ..., -option-n => value-n);
the options, bestie:
-commandβ a callback to aset_colorsreplacement.-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 ]
);
- Invoke the
Show()method on the editor object, say, by a button or menu press β the grand entrance, the moment we've all been waiting for:
$cref->Show;
- The
cget(-widgets)method returns a reference to a list of widgets that are colorized by the configurator. Typically, you add new widgets to this list and then use it in a subsequentconfigure()call to expand your color list. Growth mindset, we love to see it π±:
$cref->configure(
-widgets => [
@{$Filesystem_ref->cget(-widgets)}, @{$cref->cget(-widgets)},
]
);
- The
delete_widgets()method expects a reference to a list of widgets, which are then removed from the current color list. Bye bestie π:
$cref->delete_widgets($OBJTABLE{$objname}->{'-widgets'})
π AUTHORS π
Stephen O. Lidie, Lehigh University Computing Center. 95/03/05 lusol@Lehigh.EDU
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. Shoutout to the original translator, fr fr, that's legacy. π«ΆπΈ
and that's the whole page, babe β this was ColorEditor(3pm), page 3pm of the User Contributed Perl Documentation, from perl v5.40.1, dated 2025-04-13. slay, go colorize something π
πβ¨
π¦ where this page comes from
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms