The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
NAME
      Graphics::ColorPicker : A perl module for WYSIWYG web 
      applications that allow selection of HEX color numbers

SYNOPSIS
      use Graphics::ColorPicker;
        or
      require  Graphics::ColorPicker;

      make_page($path_to_images);
      send_page(\$html_txt,$type);
      $time_string = http_date($time);
      $name = script_name;
      $butabref = buttontext([optional array ref])
      $html_text=frames($websafe);
      $html_text = msie_frame;
      $html_text=picker($darkimg,$liteimg,$size,$bsize,greyimg);
      $html_text=no_picker;
      $html_text=cp216_ds($clrdot,$border,$square)
      $javascript_text = jslib;
      $html=make_buttons(\%look_n_feel,$url,$active,\@buttons,$xtra);
      $html_text=pluck($color);
      $html_text=hex_update($hex_color);

SAMPLE WEBSITE - 24 million color picker
  http://www.bizsystems.net/downloads/graphics/demo2.html

  http://www.bizsystems.net/downloads/graphics/demo.html

DESCRIPTION
    This module generates a set of palettes to select a HEX or DECIMAL color
    number via a web browser. make_page() can be called by "javascript" from
    your web page and will set the HEX value in a variable in the calling
    page and scope. The selector page can be created for 24 million or web
    safe colors only.

      <script language=javascript1.1>
      var colorhex = '';
      var w;
      function pop() {
        if (document.forms.color.what.checked){w=180;}else{w=630;}
        var colorwin = open("","colorpicker",
        "width=" + w + ",height=440,status=no,directories=no," +
        "location=no,menubar=no,scrollbars=no,toolbar=no");
        if (colorwin.opener == null) newin.opener = self;  
        colorwin.document.close();
        colorwin.focus();
        return true;
      }
      </script>
      <body>
      <form name="color" onSubmit="return(pop());"
       action="p_gen.cgi" target="colorpicker">   
      <input type=text name=hex size=10><br>
      <input type=checkbox name=what value=wo> web safe colors only<br>
      <input type=submit value="Pop Picker Window">
      </form>

      See B<examples/demo.html> and B<scripts/p_gen.cgi>
      Read INSTALL

    NOTE: as of version 0.13 ColorPicker can be used in a captive frame to
    dynamically update color values in the DOM.

      See B<examples/demo2.html>, 
          B<examples/colorbar.html> and
          B<scripts/p_gen2.cgi>

    make_page($path_to_images);
          Generate Color Picker Pages

          This is the only routine that really needs to be called
          externally. You could roll your own from the following
          calls for a special purpose, but it's really not necessary.

          i.e. Graphics::ColorPicker::make_page('./');

          will generate the picker pages as required

    $time_string = http_date($time);
          Returns time string in HTTP date format, same as...

          Apache::Util::ht_time(time, "%a, %d %b %Y %T %Z",1));

          i.e. Sat, 13 Apr 2002 17:36:42 GMT

    $name = script_name;
          Returns the subroutine name of the calling 
          script external to this library

    $but_table_ref = buttontext([optional ref]);
          Always return and optionally set the contents of cp216_ds button text.

            input:      optional reference to button table array
            returns:    reference to button table array

          Default contents:

          my $butable = [
            'Submit'   => 'javascript:void(0);" OnMouseDown="doSubmit();return false;',
            '','',
            'Restore'  => 'javascript:void(0);" OnClick="doRestore();return false;',
            '','',
            'Close'    => 'javascript:void (0);" OnClick="parent.close();return false;',
          ];

    $html_text=frames($websafe);
          Returns the frame text for top window.

          input:  true = 24 million colors
                  false = web safe colors only

          return:  html text for page

    $html_text = msie_frame;
          Return the text for the copyright notice
          (sample frame) for browsers that can't do
          "javascript:xxx()" from within a frame 
          like brain dead MSIE browsers.

    $html_text=picker($darkimg,$liteimg,$size,$bsize,greyimg);
          Return frame text for color picker

          input:   $darkimg, # path to dark image
                   $liteimg, # path to light image
                   $size,    # pixel size of image
                   $bsize,   # button pixel size
                   $greyimg  # path to grey image

          returns: html text

    $html_text=no_picker;
          Returns minimum contents for a blank 24 million
          color page when only "Web Only" colors are called

    $html_text=cp216_ds($clrdot,$border,$square)
          Returns 216 color & digits page

          input:   clrdot, # path to clear dot image
                   border, # border of color square
                   square, # square size

          returns: html text

    $javascript_text = jslib;
          Return contents of javascript library

          input: none

    $html=make_buttons(\%look_n_feel,$url,$active,\@buttons,$xtra);
          Called internally

          Return the html text for a button bar

          input:  button_color, width, \@buttons

          @buttons is a list of the form = (
                # text        command 
                'BUTT1' => 'command1',
                'BUTT2' => 'command2',
                ''      => '',          # empty
          );
                If the button text is false,
                a spacer is inserted in the button bar

          returns:      html for button bar

          NOTE:         class NU must be defined
          example:
                        <style>
                        A.NU { 
                          color: red; // #ff0000
                          background: transparent;
                          font-family: VERDANA,ARIAL,HELVETICA,SAN-SERIF;
                          font-size:  12px !important;
                          font-weight: bold;
                          text-decoration: none;
                        }
                        </style>

    $html_text=pluck($color, ...);
          Return x,y coordinates for browsers that
          do not recognize "javascript:xxx" from
          within frames like braindead MSIE

          input:  color,        'grey' or 'color'
                  ...server_update args (if used);

    $html_text=hex_update($hex_color);
          Return the command and color number
          to the 'data' frame to force an update
          of the 'sample' frame and 'digits'

          input: hex color      # i.e. 6699CC

    $rv = env_dumb_browser;
          Return true if $ENV{HTTP_USER_AGENT}
          contains a dumb browser

EXPORT
      None by default.

AUTHOR
    Michael Robinton, michael@bizsystems.com

COPYRIGHT and LICENSE
      Copyright 2002 - 2008 Michael Robinton, BizSystems.

    This module is free software; you can redistribute it and/or modify it
    under the terms of either:

      a) the GNU General Public License as published by the Free Software
      Foundation; either version 1, or (at your option) any later version,
  
      or

      b) the "Artistic License" which comes with this module.

    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU
    General Public License or the Artistic License for more details.

    You should have received a copy of the Artistic License with this
    module, in the file ARTISTIC. If not, I'll be glad to provide one.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA