NAME
Tk::ColorPicker - Frame based megawidget for selecting a color.
SYNOPSIS
use Tk::ColorPicker;
my $pick = $widow->ColorPicker->pack;
DESCRIPTION
Tk::ColorPicker lets you edit a color in RGB, CMY and HSV space. It has a facility to pick a screen color with your mouse. It offers a history of previous selected colors. It can work in color depths of 4, 8, 12 or 16 bits per channel. You can switch color depth on the fly.
OPTIONS
- Switch: -colordepth
-
Default value 8 bits per color channel. Can be 4, 8, 12 or 16;
- Switch: -depthselect
-
Default value 0. If set a row of radiobuttons is diplayed allowing you to switch color depth.
- Switch: -historycolumns
-
Default value 6. Number of columns in the history tab.
- Switch: -historyfile
-
Undefined by default. Here you set the filename from where the history is saved and loaded.
- Switch: -indborderwidth
-
Default value 2. Borderwidth of indicator labels in the recent tab.
- Switch: -indicatorwidth
-
Default value 4. Width of the indicator labels in the recent tab.
- Switch: -indrelief
-
Default value 'sunken'. Relief of the indicator labels in the recent tab.
- Switch: -maxhistory
-
Default value 32.Specifies the maximum number of entries in the history list.
- Switch: -notation
-
Selects in which notation the color should be represented. Default value hex. Possible values are:
- cmy
cmy(0.5, 0.5, 0.5)
-
The channel values can be between 0 and 1. It works with 3 decimals precision. For maximum accuracy set your dolor depth to 12 bits per color.
- cmyX
cmy8(127, 127, 127)
-
The X stands for the color depth. The channel values are integers ranging from 0 to the max channel value for the current selected color depth.
- hex
#7F7F7F
-
The hexadecimal notation of a color.
- hsv
hsv(360, 0, 0.5)
-
Hue value can be between 0 and 360 degrees with 1 decimal precision. Saturation and value range from 0 to 1 with 3 decimals precision.
- rgb
rgb(0.5, 0.5, 0.5)
-
The channel values can be between 0 and 1. It works with 3 decimals precision. For maximum accuracy set your dolor depth to 12 bits per color.
- rgbX
rgb8(127, 127, 127)
-
The X stands for the color depth. The channel values are integers ranging from 0 to the max channel value for the current selected color depth.
- cmy
- Switch: -notationselect
-
Default value 0. If set a menubutton is diplayed allowing you to select a notation.
- Switch: -sliderheight
-
Default value 200. Sets the length of all channel sliders.
- Switch: -updatecall
-
Set this callback to reflect changes to the outside. Gets the current color as parameter.
METHODS
- colorDepth($hexcolor)
-
Returns the color depth of $hexcolor.
- compoundColor
-
Returns a hex color string based on the Red, Green and Blue channels.
- convertCMY($string)
-
Returns the hex formatted representation of a cmy formatted string.
- convertCMYx($string)
-
Returns the hex formatted representation of a cmyX formatted string.
- convertDepth($string, ?<I$depth>?)
-
Converts the depth of $string to $depth. If $depth is not specified, -colordepth is used
- convertHEX($string)
-
Returns the hex formatted representation of a hex formatted string. So basically it does nothing but return it's input.
- convertHSV($string)
-
Returns the hex formatted representation of a hsv formatted string.
- convertRGB($string)
-
Returns the hex formatted representation of a rgb formatted string.
- convertRGBx($string)
-
Returns the hex formatted representation of a rgbX formatted string.
- getCMY
-
Returns a cmy formatted representation of the current color.
- getCMYx
-
Returns a cmyX formatted representation of the current color.
- getHEX
-
Returns a hex formatted representation of the current color.
- getHSV
-
Returns a hsv formatted representation of the current color.
- getRGB
-
Returns a rgb formatted representation of the current color.
- getRGBx
-
Returns a rgbX formatted representation of the current color.
- hex2rgb($hex)
-
Converts $hex to Red, Green Blue values.
- hexString($num, ?$depth?>)
-
Returns the hexadecimal notation of $num. If $depth is not specified, -colordepth is used
- historyAdd($color)
-
Adds color to the History list. Saves the list and updates the history tab.
- historyClear
-
Clears the history list.
- historyLoad
-
Loads the history file if it is specified.
- historyNew($color)
-
Adds $color to the history list
- historyReset
-
Clears the history list. Then saves and updates.
- historySave
-
Saves the history list.
- historyUpdate
-
Updates the history tab.
- maxChannelValue
-
Returns the maximum values for the Red, Green, Blue, Cyan, Magenta and Yellow channels, based on -colordepth.
- notationCMY($hexcolor)
-
Returns a cmy formatted string of a hex color.
- notationCMYx($hexcolor)
-
Returns a cmyX formatted string of a hex color.
- notationDetect($color)
-
Tries to detect the notation of I>$color> and returns what it finds. Returns undef if it does not detect a valid notation.
- notationHEX($hexcolor)
-
Returns a hex formatted string of a hex color. So basically it just returns it's input.
- notationHSV($hexcolor)
-
Returns a hsc formatted string of a hex color.
- notationRGB($hexcolor)
-
Returns a rgb formatted string of a hex color.
- notationRGBx($hexcolor)
-
Returns a rgbX formatted string of a hex color.
- put($color)
-
Changes all sliders to match $color
- rgb2hex($red, $green, $blue, ?$depth?)
-
Converts the red, green and blue values to a hexstring. If depth is not specified, -colordepth is used.
- validate(?$color?)
-
Returns true if $color is a valid color.
LICENSE
Same as Perl.
AUTHOR
Hans Jeuken (hanje at cpan dot org)
BUGS
Switching color depth straight after initialization gives unwanted results.
Cancelling a pick operation only works in the context of Tk::ColorEntry.