Tk::Spectrum - A stylish color selection dialog. |
Tk::Spectrum - A stylish color selection dialog.
use Tk::Spectrum;
my $color = $mw->Spectrum ( -title => 'Pick a Color', -initialcolor => '#000000', -buttons => [ 'Ok', 'Cancel' ], -preset => [ $preset_colors ], );
print "You chose $color\n";
Tk::Spectrum is a stylish color selection dialog. It presents the user with a full color spectrum with which they can click and drag to select colors, as well as a form where they can select RGB and Hexadecimal color values. It also supports a ``preset color list'' similar to the Win32 native color dialog box. The program can define which colors go into this list.
Note: This module only knows how to deal with hexadecimal numbers. It's impossible from the end user's side to enter a non-hex value, but if your program uses colors by name and you try to use named colors in Tk::Spectrum, it will cause errors.
The options supported by Tk::Spectrum are as follows:
-preset => [ # Row 1 [ '#FF0000', '#00FF00', '#0000FF' ], # Row 2 [ '#990000', '#009900', '#000099' ], ],
You can have virtually as many rows and columns as you need, but keep in mind that the dialog window size may grow to accomodate.
Version 0.02 - Added dependency on Tk and Tk::PNG to Makefile.PL to stop CPAN's nagging
Version 0.01 - Initial release
Casey Kirsle
This module is distributed under the same terms as Perl itself.
Tk::Spectrum - A stylish color selection dialog. |